loolwsd: set ShutdownFlag only with SIGINT

The logic is to use ShutdownFlag only in WSD to
initiate graceful shut down while saving documents.

When CTRL+C is hit WSD, forkit, and kits get SIGINT,
but only WSD should handle ShutdownFlag. Others are
signaled internally by WSD to terminate using SIGTERM.

The second CTRL+C on WSD will flag TerminationFlag
for more aggressive shutdown. This is logged on every
subsequent signal and not just the first.

Furthermore, any other signal to WSD should terminate
more aggressively, so no reason to set ShutdownFlag
in those cases.

Change-Id: I10fa38fe85925da1020983f897cc6cdbbd2623f8
Reviewed-on: https://gerrit.libreoffice.org/30887
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-11-15 21:57:41 -05:00 committed by Ashod Nakashian
parent f7b6ece593
commit 0f9bd80ca2

View file

@ -119,17 +119,15 @@ namespace SigUtil
static
void handleTerminationSignal(const int signal)
{
if (!ShutdownFlag)
if (!ShutdownFlag && signal == SIGINT)
{
Log::signalLogPrefix();
Log::signalLog(" Shutdown signal received: ");
Log::signalLog(signalName(signal));
Log::signalLog("\n");
ShutdownFlag = true;
return;
}
if (!TerminationFlag)
else
{
Log::signalLogPrefix();
Log::signalLog(" Forced-Termination signal received: ");