diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-05-16 03:30:35 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-05-16 03:30:35 -0400 |
commit | f3d855e9bc118f0b2fad8c1ff3e539ba77e1eabb (patch) | |
tree | 81d770bf1a020891743933cda842fe655d5707df /src/daemon.c | |
parent | eabb10d017c312c5fac5446fbac5a1c23af94ae3 (diff) | |
download | runes-f3d855e9bc118f0b2fad8c1ff3e539ba77e1eabb.tar.gz runes-f3d855e9bc118f0b2fad8c1ff3e539ba77e1eabb.zip |
add a message type for killing the daemon
and make ./runesc --kill-daemon send that message
Diffstat (limited to 'src/daemon.c')
-rw-r--r-- | src/daemon.c | 8 |
1 files changed, 6 insertions, 2 deletions
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( |