From f3d855e9bc118f0b2fad8c1ff3e539ba77e1eabb Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 16 May 2016 03:30:35 -0400 Subject: add a message type for killing the daemon and make ./runesc --kill-daemon send that message --- src/daemon.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/daemon.c') diff --git a/src/daemon.c b/src/daemon.c index c354d67..b3cd11a 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -50,7 +50,7 @@ void runes_socket_delete(RunesDaemon *daemon) static int runes_daemon_handle_request(void *t) { RunesDaemon *daemon = (RunesDaemon *)t; - int client_sock, type; + int client_sock, type, ret = 1; char *buf; size_t len; @@ -61,6 +61,10 @@ static int runes_daemon_handle_request(void *t) case RUNES_PROTOCOL_NEW_TERM: runes_daemon_handle_new_term_message(daemon, buf, len); break; + case RUNES_PROTOCOL_KILL_DAEMON: + ret = 0; + runes_loop_stop(daemon->loop); + break; default: runes_warn("unknown packet type: %d", type); break; @@ -74,7 +78,7 @@ static int runes_daemon_handle_request(void *t) runes_socket_client_close(client_sock); - return 1; + return ret; } static void runes_daemon_handle_new_term_message( -- cgit v1.2.3-54-g00ecf