net/Socket.hpp  |    4 ++--
 wsd/LOOLWSD.cpp |   13 ++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit cbe6f0c813116b0fee78a78cee19f10a1c1b7b35
Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
Date:   Wed Apr 5 22:35:22 2017 -0400

    wsd: move prisoner socket in the poll thread
    
    Change-Id: I4097da97d4485d98618604c039a4570efe52bc19
    Reviewed-on: https://gerrit.libreoffice.org/36181
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/net/Socket.hpp b/net/Socket.hpp
index 6bfc6312..d1a59b22 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -459,8 +459,8 @@ public:
         assert(it != _pollSockets.end());
 
         _pollSockets.erase(it);
-        LOG_TRC("Release socket #" << socket->getFD() << " from " << _name <<
-                " leaving " << _pollSockets.size());
+        LOG_DBG("Removing socket #" << socket->getFD() << " (of " <<
+                _pollSockets.size() << ") from " << _name);
     }
 
     size_t getSocketCount() const
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index d2506f24..08a20ce7 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1458,6 +1458,8 @@ private:
                 return SocketHandlerInterface::SocketOwnership::UNCHANGED;
             }
 
+            in.clear();
+
             LOG_INF("New child [" << pid << "].");
 
             UnitWSD::get().newChild(*this);
@@ -1466,15 +1468,13 @@ private:
             _childProcess = child; // weak
             addNewChild(child);
 
-            // We no longer own this thread: FIXME.
+            // We no longer own this socket.
             socket->setThreadOwner(std::thread::id(0));
 
             // Remove from prisoner poll since there is no activity
             // until we attach the childProcess (with this socket)
             // to a docBroker, which will do the polling.
-            PrisonerPoll.releaseSocket(socket);
-
-            in.clear();
+            return SocketHandlerInterface::SocketOwnership::MOVED;
         }
         catch (const std::exception& exc)
         {
@@ -1848,7 +1848,6 @@ private:
 
                     cleanupDocBrokers();
 
-                    // FIXME: What if the same document is already open? Need 
a fake dockey here?
                     LOG_DBG("New DocumentBroker for docKey [" << docKey << 
"].");
                     DocBrokers.emplace(docKey, docBroker);
                     LOG_TRC("Have " << DocBrokers.size() << " DocBrokers after 
inserting [" << docKey << "].");
@@ -1865,7 +1864,7 @@ private:
                         // Make sure the thread is running before adding 
callback.
                         docBroker->startThread();
 
-                        // We no longer own this thread: FIXME.
+                        // We no longer own this socket.
                         socket->setThreadOwner(std::thread::id(0));
 
                         docBroker->addCallback([docBroker, socket, 
clientSession, format]()
@@ -2094,7 +2093,7 @@ private:
                 // Make sure the thread is running before adding callback.
                 docBroker->startThread();
 
-                // We no longer own this thread: FIXME.
+                // We no longer own this socket.
                 socket->setThreadOwner(std::thread::id(0));
 
                 docBroker->addCallback([docBroker, socket, clientSession]()
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to