wsd: move prisoner socket in the poll thread

Change-Id: I4097da97d4485d98618604c039a4570efe52bc19
Reviewed-on: https://gerrit.libreoffice.org/36181
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2017-04-05 22:35:22 -04:00 committed by Ashod Nakashian
parent bb4459a288
commit cbe6f0c813
2 changed files with 8 additions and 9 deletions

View file

@ -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

View file

@ -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]()