[Libreoffice-commits] online.git: wsd/LOOLWebSocket.hpp wsd/LOOLWSD.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 23 05:41:20 UTC 2017


 wsd/LOOLWSD.cpp       |    1 +
 wsd/LOOLWebSocket.hpp |   10 ++++++++++
 2 files changed, 11 insertions(+)

New commits:
commit b497fcfac54d10ca67c0906f59a6b69f0940310e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri Jan 20 16:34:10 2017 -0500

    wsd: close the socket when shutting down fails
    
    Change-Id: Iea5c6a259272b6af881a5bfb27ffc31d2ad27793
    Reviewed-on: https://gerrit.libreoffice.org/33424
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index f41cb70..10bc54d 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -194,6 +194,7 @@ namespace
 inline void shutdownLimitReached(LOOLWebSocket& ws)
 {
     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
        after web socket handshake, so closing web socket fails loading page in
diff --git a/wsd/LOOLWebSocket.hpp b/wsd/LOOLWebSocket.hpp
index dc2c805..b1acd35 100644
--- a/wsd/LOOLWebSocket.hpp
+++ b/wsd/LOOLWebSocket.hpp
@@ -223,6 +223,16 @@ public:
         {
             LOG_WRN("LOOLWebSocket::shutdown: Exception: " << exc.displayText() <<
                     (exc.nested() ? " (" + exc.nested()->displayText() + ")" : ""));
+
+            // Just close it.
+            try
+            {
+                Poco::Net::WebSocket::close();
+            }
+            catch (const std::exception&)
+            {
+                // Nothing we can do.
+            }
         }
     }
 };


More information about the Libreoffice-commits mailing list