aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/server.c9
-rw-r--r--src/worker.c7
2 files changed, 13 insertions, 3 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);
diff --git a/src/worker.c b/src/worker.c
index 05243ac..7471cd1 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -195,8 +195,13 @@ int worker_main(struct worker *worker, UNUSED int argc, UNUSED char *argv[])
log("Waiting for a new command\n");
ret = msg_recv(worker->fd, &request);
- if (ret < 0)
+ if (ret < 0) {
+ if (errno == EINVAL && global_stop_flag) {
+ ret = 0;
+ break;
+ }
return ret;
+ }
ret = worker_msg_handler(worker, &request);
msg_free(&request);