[Libreoffice-commits] online.git: net/Socket.hpp wsd/DocumentBroker.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Mar 27 03:21:56 UTC 2017


 net/Socket.hpp         |    6 ++++++
 wsd/DocumentBroker.cpp |    4 ++++
 2 files changed, 10 insertions(+)

New commits:
commit 6d7f39356c26aed41aef5042b13e52aa63e9d812
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Mar 26 23:10:24 2017 -0400

    wsd: flush sockets before exiting DocBroker poll thread
    
    Change-Id: Id5384c113bd761b5b8c25286f1bd5a28051c63d3
    Reviewed-on: https://gerrit.libreoffice.org/35740
    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 9ff5a85a..95384397 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -435,6 +435,12 @@ public:
                 " leaving " << _pollSockets.size());
     }
 
+    size_t getSocketCount() const
+    {
+        assert(isCorrectThread());
+        return _pollSockets.size();
+    }
+
     const std::string& name() const { return _name; }
 
     /// Start the polling thread (if desired)
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 26452a9b..97b81fdd 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -247,6 +247,10 @@ void DocumentBroker::pollThread()
         }
     }
 
+    // Flush socket data.
+    for (int i = 0; i < 7 && _poll->getSocketCount() > 0; ++i)
+        _poll->poll(POLL_TIMEOUT_MS / 5);
+
     // Terminate properly while we can.
     auto lock = getLock();
     terminateChild(lock, "", false);


More information about the Libreoffice-commits mailing list