diff options
author | nicm <nicm> | 2018-03-08 08:09:10 +0000 |
---|---|---|
committer | nicm <nicm> | 2018-03-08 08:09:10 +0000 |
commit | 19f3a5c6120c5d845eb942e67413c03c0c008a87 (patch) | |
tree | fbd4fb03833b499bfa23d77394ba5b6365e00a01 /server.c | |
parent | 85c48aafffd4e520eea2e598ea199e7b16f787cc (diff) | |
download | rtmux-19f3a5c6120c5d845eb942e67413c03c0c008a87.tar.gz rtmux-19f3a5c6120c5d845eb942e67413c03c0c008a87.tar.bz2 rtmux-19f3a5c6120c5d845eb942e67413c03c0c008a87.zip |
Add a missing client-detached hook when the server shuts down, and do
not exit until jobs started from run-shell/if-shell have finished (add a
job flags member and a flag to indicate other jobs). GitHub issue 1245.
Diffstat (limited to 'server.c')
-rw-r--r-- | server.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -244,6 +244,7 @@ server_loop(void) { struct client *c; u_int items; + struct job *job; do { items = cmdq_next(NULL); @@ -276,6 +277,11 @@ server_loop(void) if (!TAILQ_EMPTY(&clients)) return (0); + LIST_FOREACH(job, &all_jobs, entry) { + if ((~job->flags & JOB_NOWAIT) && job->state == JOB_RUNNING) + return (0); + } + return (1); } @@ -291,8 +297,11 @@ server_send_exit(void) TAILQ_FOREACH_SAFE(c, &clients, entry, c1) { if (c->flags & CLIENT_SUSPENDED) server_client_lost(c); - else + else { + if (c->flags & CLIENT_ATTACHED) + notify_client("client-detached", c); proc_send(c->peer, MSG_SHUTDOWN, -1, NULL, 0); + } c->session = NULL; } |