loolwsd: Don't block on client sockets and timeout in 1 second

Change-Id: I7fec1054cef25704f898a7a5211abfb398d61bee
Reviewed-on: https://gerrit.libreoffice.org/28576
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-08-31 23:40:42 -04:00 committed by Ashod Nakashian
parent 59eaacd2f8
commit 9b3343aad4
2 changed files with 4 additions and 0 deletions

View file

@ -20,6 +20,7 @@ constexpr int WSD_SLEEP_SECS = 2;
constexpr int CHILD_TIMEOUT_SECS = 4;
constexpr int POLL_TIMEOUT_MS = 1000;
constexpr int COMMAND_TIMEOUT_MS = 5000;
constexpr int WS_SEND_TIMEOUT_MICROSECS = 1000000; // 1 second.
/// Pipe and Socket read buffer size.
/// Should be large enough for ethernet packets

View file

@ -905,6 +905,9 @@ public:
responded = true; // After upgrading to WS we should not set HTTP response.
try
{
// First, setup WS options.
ws->setBlocking(false);
ws->setSendTimeout(WS_SEND_TIMEOUT_MICROSECS);
handleGetRequest(request, ws, id);
}
catch (const WebSocketErrorMessageException& exc)