Make closing the document work again in the iOS (and Android?) app

But opening a second document now hangs.

Sigh, the plumbing in the mobile apps is so extremely fragile. But
that is to be expected when turning a multi-process structure (where
one class of processes exit as soon as they have done their job) into
a single process running forever.

Change-Id: I0fdb751f44e16efb42843189969e049bf14816f0
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90443
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
Tor Lillqvist 2020-03-12 22:17:05 +02:00
parent 188d00ce4a
commit d4e0835043
3 changed files with 11 additions and 4 deletions

View file

@ -2149,14 +2149,21 @@ protected:
LOG_DBG("CreateSession failed.");
}
}
#if !MOBILEAPP
else if (tokens.equals(0, "exit"))
{
#if !MOBILEAPP
LOG_INF("Terminating immediately due to parent 'exit' command.");
Log::shutdown();
std::_Exit(EX_SOFTWARE);
}
#else
LOG_INF("Setting TerminationFlag due to 'exit' command.");
SigUtil::setTerminationFlag();
// Not really a logic error, but hey. This is expected to be caught in SocketPoll::poll().
throw std::logic_error("exit");
#endif
}
else if (tokens.equals(0, "tile") || tokens.equals(0, "tilecombine") || tokens.equals(0, "canceltiles") ||
tokens.equals(0, "paintwindow") || tokens.equals(0, "resizewindow") ||
LOOLProtocol::getFirstToken(tokens[0], '-') == "child")

View file

@ -673,6 +673,7 @@ public:
LOG_ERR("Error while handling poll for socket #" <<
_pollFds[i].fd << " in " << _name << ": " << exc.what());
disposition.setClosed();
rc = -1;
}
if (disposition.isMove() || disposition.isClosed())

View file

@ -108,7 +108,6 @@ public:
try
{
#if !MOBILEAPP // There is no "child process" in a mobile app
LOG_DBG("Closing ChildProcess [" << _pid << "].");
// Request the child to exit
@ -117,7 +116,7 @@ public:
LOG_DBG("Stopping ChildProcess [" << _pid << "] by sending 'exit' command.");
sendTextFrame("exit");
}
#endif
// Shutdown the socket.
if (_ws)
_ws->shutdown();