[Libreoffice-commits] online.git: net/Socket.hpp net/SslSocket.hpp net/WebSocketHandler.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 22 09:14:36 UTC 2018


 net/Socket.hpp           |    2 ++
 net/SslSocket.hpp        |    4 ++--
 net/WebSocketHandler.hpp |    3 +++
 3 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 11cdfb7688dea76d2647758af767187903a0ec72
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Jan 21 20:34:38 2018 -0500

    wsd: avoid misleading socket error logs
    
    Change-Id: Ie70d8eb1ecc0442643f4b2a4757b95688b4cf1f7
    Reviewed-on: https://gerrit.libreoffice.org/48284
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/net/Socket.hpp b/net/Socket.hpp
index 01759953..da34b5e3 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -730,6 +730,8 @@ public:
         }
     }
 
+    bool isClosed() const { return _closed; }
+
     /// Just trigger the async shutdown.
     virtual void shutdown() override
     {
diff --git a/net/SslSocket.hpp b/net/SslSocket.hpp
index 4b5d1323..2f8d45cb 100644
--- a/net/SslSocket.hpp
+++ b/net/SslSocket.hpp
@@ -251,8 +251,8 @@ private:
                 {
                     if (rc == 0)
                     {
-                        // Socket closed.
-                        LOG_ERR("Socket #" << getFD() << " SSL BIO error: closed (0).");
+                        // Socket closed. Not an error.
+                        LOG_INF("Socket #" << getFD() << " SSL BIO error: closed (0).");
                         return 0;
                     }
                     else if (rc == -1)
diff --git a/net/WebSocketHandler.hpp b/net/WebSocketHandler.hpp
index 1b37389d..161272e9 100644
--- a/net/WebSocketHandler.hpp
+++ b/net/WebSocketHandler.hpp
@@ -337,6 +337,9 @@ protected:
         if (!socket || data == nullptr || len == 0)
             return -1;
 
+        if (socket->isClosed())
+            return 0;
+
         socket->assertCorrectThread();
         std::vector<char>& out = socket->_outBuffer;
         const size_t oldSize = out.size();


More information about the Libreoffice-commits mailing list