[client] unconditionally quit on second SIGINT

Under some circumstances, Looking Glass can hang when SIGINT'd, for
instance, if it's stuck waiting on spice I/O that won't complete because
the guest is misbehaving.

This commit provides an escape hatch for such cases, so one doesn't have
to reach for `kill -9 $(pidof looking-glass-client)`.
This commit is contained in:
Tudor Brindus 2021-01-24 17:10:52 -05:00 committed by Geoffrey McRae
parent f9ec32b255
commit 941c651fad

View File

@ -1609,14 +1609,23 @@ int eventFilter(void * userdata, SDL_Event * event)
return 0;
}
void int_handler(int signal)
void int_handler(int sig)
{
switch(signal)
switch(sig)
{
case SIGINT:
case SIGTERM:
if (g_state.state != APP_STATE_SHUTDOWN)
{
DEBUG_INFO("Caught signal, shutting down...");
g_state.state = APP_STATE_SHUTDOWN;
}
else
{
DEBUG_INFO("Caught second signal, force quitting...");
signal(sig, SIG_DFL);
raise(sig);
}
break;
}
}