wsd: close the socket when shutting down fails
Change-Id: Iea5c6a259272b6af881a5bfb27ffc31d2ad27793 Reviewed-on: https://gerrit.libreoffice.org/33424 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
parent
0fe580d9ab
commit
b497fcfac5
2 changed files with 11 additions and 0 deletions
|
@ -194,6 +194,7 @@ namespace
|
||||||
inline void shutdownLimitReached(LOOLWebSocket& ws)
|
inline void shutdownLimitReached(LOOLWebSocket& ws)
|
||||||
{
|
{
|
||||||
const std::string error = Poco::format(PAYLOAD_UNAVAILABLE_LIMIT_REACHED, MAX_DOCUMENTS, MAX_CONNECTIONS);
|
const std::string error = Poco::format(PAYLOAD_UNAVAILABLE_LIMIT_REACHED, MAX_DOCUMENTS, MAX_CONNECTIONS);
|
||||||
|
LOG_INF("Sending client limit-reached message: " << error);
|
||||||
|
|
||||||
/* loleaflet sends loolclient, load and partrectangles message immediately
|
/* loleaflet sends loolclient, load and partrectangles message immediately
|
||||||
after web socket handshake, so closing web socket fails loading page in
|
after web socket handshake, so closing web socket fails loading page in
|
||||||
|
|
|
@ -223,6 +223,16 @@ public:
|
||||||
{
|
{
|
||||||
LOG_WRN("LOOLWebSocket::shutdown: Exception: " << exc.displayText() <<
|
LOG_WRN("LOOLWebSocket::shutdown: Exception: " << exc.displayText() <<
|
||||||
(exc.nested() ? " (" + exc.nested()->displayText() + ")" : ""));
|
(exc.nested() ? " (" + exc.nested()->displayText() + ")" : ""));
|
||||||
|
|
||||||
|
// Just close it.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Poco::Net::WebSocket::close();
|
||||||
|
}
|
||||||
|
catch (const std::exception&)
|
||||||
|
{
|
||||||
|
// Nothing we can do.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue