diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-05-06 15:54:55 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-05-06 15:55:06 +0200 |
commit | 156edd022ef315eb68e0f7002994dfeb172a25c1 (patch) | |
tree | 596268f59b72cc1ccf1e2aad7e64297a3ff8b2de /src/server.c | |
parent | get rid of __attribute__((constructor)) (diff) | |
download | cimple-156edd022ef315eb68e0f7002994dfeb172a25c1.tar.gz cimple-156edd022ef315eb68e0f7002994dfeb172a25c1.zip |
shut down server/workers gracefully on SIGTERM
Diffstat (limited to 'src/server.c')
-rw-r--r-- | src/server.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/server.c b/src/server.c index 33610f3..51ee27f 100644 --- a/src/server.c +++ b/src/server.c @@ -393,8 +393,13 @@ int server_main(struct server *server) log("Waiting for new connections\n"); ret = tcp_server_accept(server->tcp_server, server_conn_handler, server); - if (ret < 0) - break; + if (ret < 0) { + if (errno == EINVAL && global_stop_flag) { + ret = 0; + break; + } + return ret; + } } return server_set_stopping(server); |