diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-21 22:47:31 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-21 22:47:31 +0000 |
commit | 392e13534961b80984711f82230d9f34ca4a81bb (patch) | |
tree | a8f40eaba5b6b9e637fa6f469de8add9caea35f0 /client-msg.c | |
parent | 9acc26711d180e45ff827d8b88b4adbf20fab949 (diff) | |
download | rtmux-392e13534961b80984711f82230d9f34ca4a81bb.tar.gz rtmux-392e13534961b80984711f82230d9f34ca4a81bb.tar.bz2 rtmux-392e13534961b80984711f82230d9f34ca4a81bb.zip |
Handle SIGTERM (and kill-server which uses it), a bit more neatly - tidy up
properly and print a nicer message. Same effect though :-)
Diffstat (limited to 'client-msg.c')
-rw-r--r-- | client-msg.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/client-msg.c b/client-msg.c index 7f2f3dca..182b26f2 100644 --- a/client-msg.c +++ b/client-msg.c @@ -1,4 +1,4 @@ -/* $Id: client-msg.c,v 1.17 2009-01-18 12:09:42 nicm Exp $ */ +/* $Id: client-msg.c,v 1.18 2009-01-21 22:47:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -27,6 +27,7 @@ int client_msg_fn_detach(struct hdr *, struct client_ctx *, char **); int client_msg_fn_error(struct hdr *, struct client_ctx *, char **); +int client_msg_fn_shutdown(struct hdr *, struct client_ctx *, char **); int client_msg_fn_exit(struct hdr *, struct client_ctx *, char **); int client_msg_fn_exited(struct hdr *, struct client_ctx *, char **); int client_msg_fn_suspend(struct hdr *, struct client_ctx *, char **); @@ -40,6 +41,7 @@ struct client_msg client_msg_table[] = { { MSG_ERROR, client_msg_fn_error }, { MSG_EXIT, client_msg_fn_exit }, { MSG_EXITED, client_msg_fn_exited }, + { MSG_SHUTDOWN, client_msg_fn_shutdown }, { MSG_SUSPEND, client_msg_fn_suspend }, }; @@ -95,6 +97,19 @@ client_msg_fn_detach( } int +client_msg_fn_shutdown( + struct hdr *hdr, unused struct client_ctx *cctx, unused char **error) +{ + if (hdr->size != 0) + fatalx("bad MSG_SHUTDOWN size"); + + client_write_server(cctx, MSG_EXITING, NULL, 0); + cctx->flags |= CCTX_SHUTDOWN; + + return (0); +} + +int client_msg_fn_exit( struct hdr *hdr, unused struct client_ctx *cctx, unused char **error) { |