[Libreoffice-commits] online.git: loolwsd/Common.hpp loolwsd/LOOLWSD.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Sep 1 04:00:35 UTC 2016


 loolwsd/Common.hpp  |    1 +
 loolwsd/LOOLWSD.cpp |    3 +++
 2 files changed, 4 insertions(+)

New commits:
commit 9b3343aad49637afe944da3ee83062e55217ee48
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Aug 31 23:40:42 2016 -0400

    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 at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/Common.hpp b/loolwsd/Common.hpp
index f76b823..3e5d5e9 100644
--- a/loolwsd/Common.hpp
+++ b/loolwsd/Common.hpp
@@ -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
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 5efbd39..0637bf3 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -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)


More information about the Libreoffice-commits mailing list