wsd: move headless check in enqueue function

Change-Id: I2a09d2c5e5c1705e5caeb8563babcd939384a583
Reviewed-on: https://gerrit.libreoffice.org/33432
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2017-01-21 20:59:45 -05:00 committed by Ashod Nakashian
parent 1f3d9ee457
commit c7e2a4cc88
2 changed files with 11 additions and 9 deletions

View file

@ -68,8 +68,17 @@ public:
void enqueueSendMessage(const std::shared_ptr<Message>& data)
{
LOG_TRC(getName() << " enqueueing client message: " << data->abbr());
_senderQueue.enqueue(data);
if (isHeadless())
{
// Fail silently and return as there is no actual websocket
// connection in this case.
LOG_INF(getName() << ": Headless peer, not forwarding message [" << data->abbr() << "].");
}
else
{
LOG_TRC(getName() << " enqueueing client message: " << data->abbr());
_senderQueue.enqueue(data);
}
}
bool stopping() const { return _stop || _senderQueue.stopping(); }

View file

@ -275,13 +275,6 @@ bool PrisonerSession::forwardToPeer(const std::shared_ptr<Message>& payload)
LOG_TRC(getName() << ": peer began the closing handshake. Dropping forward message [" << message << "].");
return true;
}
else if (_peer.isHeadless())
{
// Fail silently and return as there is no actual websocket
// connection in this case.
LOG_INF(getName() << ": Headless peer, not forwarding message [" << message << "].");
return true;
}
LOG_TRC(getName() << " -> " << _peer.getName() << ": " << message);
_peer.enqueueSendMessage(payload);