[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 authored and Geoffrey McRae committed 2021-01-25 09:39:35 +11:00
1 parent f9ec32b255
commit 941c651fad
1 file changed
+13 -4
+13 -4
View File
@@ -1609,14 +1609,23 @@ int eventFilter(void * userdata, SDL_Event * event)
return 0; return 0;
} }
void int_handler(int signal) void int_handler(int sig)
{ {
switch(signal) switch(sig)
{ {
case SIGINT: case SIGINT:
case SIGTERM: case SIGTERM:
DEBUG_INFO("Caught signal, shutting down..."); if (g_state.state != APP_STATE_SHUTDOWN)
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; break;
} }
} }