diff options
author | nicm <nicm> | 2019-06-07 20:09:17 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-06-07 20:09:17 +0000 |
commit | e37f34facc05c3ba146d4158cc7af23f6886fecd (patch) | |
tree | d5136e2303a92820ab6b5d532d96c8ac1b53b6db /server.c | |
parent | 8f40796f05f2db0ff8b2c9231054b62b511a7ba0 (diff) | |
download | rtmux-e37f34facc05c3ba146d4158cc7af23f6886fecd.tar.gz rtmux-e37f34facc05c3ba146d4158cc7af23f6886fecd.tar.bz2 rtmux-e37f34facc05c3ba146d4158cc7af23f6886fecd.zip |
Do not load the config file if the server is exiting because it failed
to start, otherwise commands like lsk which start the server again can
end up looping infinitely. Also make the first client exit
correctly. Problem reported by Wael M Nasreddine.
Diffstat (limited to 'server.c')
-rw-r--r-- | server.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -44,7 +44,7 @@ struct clients clients; struct tmuxproc *server_proc; -static int server_fd; +static int server_fd = -1; static int server_exit; static struct event server_ev_accept; @@ -208,11 +208,10 @@ server_start(struct tmuxproc *client, struct event_base *base, int lockfd, cmdq_append(c, cmdq_get_error(cause)); free(cause); c->flags |= CLIENT_EXIT; - } + } else + start_cfg(); - start_cfg(); server_add_accept(0); - proc_loop(server_proc, server_loop); job_kill_all(); @@ -364,6 +363,9 @@ server_add_accept(int timeout) { struct timeval tv = { timeout, 0 }; + if (server_fd == -1) + return; + if (event_initialized(&server_ev_accept)) event_del(&server_ev_accept); |