loolwsd: unload child view when client disconnects
Using a new internal command, when a client disconnects an internal 'disconnect' message is dispatched so the child process cleans up the ChildSession in question. Change-Id: I34166ad59e84ae389a3913bd2430fe537225bb4b Reviewed-on: https://gerrit.libreoffice.org/29650 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
parent
1edd37ea2d
commit
4fa7e53eae
3 changed files with 29 additions and 0 deletions
|
@ -441,6 +441,10 @@ size_t DocumentBroker::removeSession(const std::string& id)
|
|||
if (it != _sessions.end())
|
||||
{
|
||||
_sessions.erase(it);
|
||||
|
||||
// Let the child know the client has disconnected.
|
||||
const std::string msg("child-" + id + " disconnect");
|
||||
_childProcess->getWebSocket()->sendFrame(msg.data(), msg.size());
|
||||
}
|
||||
|
||||
return _sessions.size();
|
||||
|
|
|
@ -1264,6 +1264,13 @@ private:
|
|||
const auto it = _connections.find(viewId);
|
||||
if (it != _connections.end())
|
||||
{
|
||||
if (message == "disconnect")
|
||||
{
|
||||
Log::debug("Removing ChildSession " + value);
|
||||
_connections.erase(it);
|
||||
return true;
|
||||
}
|
||||
|
||||
auto session = it->second->getSession();
|
||||
if (session)
|
||||
{
|
||||
|
|
|
@ -373,6 +373,24 @@ saveas: url=<url>
|
|||
<url> is a URL of the destination, encoded. Sent from the child to the
|
||||
parent after a saveAs() completed.
|
||||
|
||||
client-<sessionId> <Payload Message>
|
||||
|
||||
Forwarding message between a child and its parent session.
|
||||
The payload message is forwarded to the ClientSession.
|
||||
|
||||
parent -> child
|
||||
===============
|
||||
|
||||
child-<sessionId> <Payload Message>
|
||||
|
||||
Forwarding message between a parent and its child session.
|
||||
The payload message is forwarded to the ChildSession.
|
||||
|
||||
disconnect
|
||||
|
||||
Signals to the child that the client for the respective connection
|
||||
has disconnected.
|
||||
|
||||
Admin console
|
||||
===============
|
||||
|
||||
|
|
Loading…
Reference in a new issue