diff options
author | Přemysl Janouch <p@janouch.name> | 2018-10-17 06:08:11 +0200 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-10-17 06:08:11 +0200 |
commit | efd500ca3cf4dfdc635ccd71ea8baf5a0d3c5bbd (patch) | |
tree | 8ecb82eb94b6b61c18ff7134829735e6aa472696 | |
parent | 13892fcd0e2f95b8033b92838996b0b700905652 (diff) | |
download | json-rpc-shell-efd500ca3cf4dfdc635ccd71ea8baf5a0d3c5bbd.tar.gz json-rpc-shell-efd500ca3cf4dfdc635ccd71ea8baf5a0d3c5bbd.tar.xz json-rpc-shell-efd500ca3cf4dfdc635ccd71ea8baf5a0d3c5bbd.zip |
Accelerated daemon quitting
-rw-r--r-- | demo-json-rpc-server.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/demo-json-rpc-server.c b/demo-json-rpc-server.c index ce50c0f..cde6ad0 100644 --- a/demo-json-rpc-server.c +++ b/demo-json-rpc-server.c @@ -2586,10 +2586,14 @@ on_termination_signal (EV_P_ ev_signal *handle, int revents) (void) handle; (void) revents; - // TODO: consider quitting right away if already quitting; - // considering that this may already happen in timeout, it should be OK; - // see on_quit_timeout, just destroy all clients - initiate_quit (ctx); + if (ctx->quitting) + { + // Double C-c from the terminal accelerates the process + LIST_FOR_EACH (struct client, iter, ctx->clients) + client_destroy (iter); + } + else + initiate_quit (ctx); } static void |