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

Henry Castro hcastro at collabora.com
Mon Oct 3 19:02:39 UTC 2016


 loolwsd/LOOLWSD.cpp |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit e684089c89c7d56bd48b25c07bdb6b71a35d34ea
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon Oct 3 14:36:02 2016 -0400

    loolwsd: force websocket close if client does not want to close
    
    Even if sever send a close frame, the client could still send
    more messages, but no close frame.

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 77a0399..95ce1fc 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -190,7 +190,7 @@ void lcl_shutdownLimitReached(WebSocket& ws)
     try
     {
         int flags = 0;
-        int handshake = 3;
+        int retries = 7;
         std::vector<char> buffer(READ_BUFFER_SIZE * 100);
 
         // 5 seconds timeout
@@ -199,15 +199,15 @@ void lcl_shutdownLimitReached(WebSocket& ws)
         {
             // ignore loolclient, load and partpagerectangles
             ws.receiveFrame(buffer.data(), buffer.capacity(), flags);
-            if (--handshake == 0)
+            if (--retries == 4)
             {
                 ws.sendFrame(error.data(), error.size());
                 ws.shutdown(WebSocket::WS_POLICY_VIOLATION, close);
             }
         }
-        while ((flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE);
+        while (retries > 0 && (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE);
     }
-    catch (Exception& e)
+    catch (Exception&)
     {
         ws.sendFrame(error.data(), error.size());
         ws.shutdown(WebSocket::WS_POLICY_VIOLATION, close);


More information about the Libreoffice-commits mailing list