diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-11-27 20:01:30 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-11-27 20:01:30 +0000 |
commit | 5cd1d459c5351774dbcda51911278d781384bf0f (patch) | |
tree | 8da5e09bbf78870f9ce02c80577b47c188150b17 /server-msg.c | |
parent | 2fabfb30b0275a0adc7b5bc0a260ab830d1f41ed (diff) | |
download | rtmux-5cd1d459c5351774dbcda51911278d781384bf0f.tar.gz rtmux-5cd1d459c5351774dbcda51911278d781384bf0f.tar.bz2 rtmux-5cd1d459c5351774dbcda51911278d781384bf0f.zip |
Three-stage exit process so that [] message printing works on detach etc.
Diffstat (limited to 'server-msg.c')
-rw-r--r-- | server-msg.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/server-msg.c b/server-msg.c index afa947bb..a9f77bc2 100644 --- a/server-msg.c +++ b/server-msg.c @@ -1,5 +1,5 @@ -/* $Id: server-msg.c,v 1.38 2007-11-27 19:23:34 nicm Exp $ */ +/* $Id: server-msg.c,v 1.39 2007-11-27 20:01:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -29,6 +29,7 @@ int server_msg_fn_command(struct hdr *, struct client *); int server_msg_fn_identify(struct hdr *, struct client *); int server_msg_fn_resize(struct hdr *, struct client *); +int server_msg_fn_exiting(struct hdr *, struct client *); void printflike2 server_msg_fn_command_error( struct cmd_ctx *, const char *, ...); @@ -44,6 +45,7 @@ const struct server_msg server_msg_table[] = { { MSG_IDENTIFY, server_msg_fn_identify }, { MSG_COMMAND, server_msg_fn_command }, { MSG_RESIZE, server_msg_fn_resize }, + { MSG_EXITING, server_msg_fn_exiting } }; #define NSERVERMSG (sizeof server_msg_table / sizeof server_msg_table[0]) @@ -238,3 +240,23 @@ server_msg_fn_resize(struct hdr *hdr, struct client *c) return (0); } + +int +server_msg_fn_exiting(struct hdr *hdr, struct client *c) +{ + if (hdr->size != 0) + fatalx("bad MSG_EXITING size"); + + log_debug("exiting msg from client"); + + c->session = NULL; + + if (c->tty.fd != -1) + tty_free(&c->tty); + + recalculate_sizes(); + + server_write_client(c, MSG_EXITED, NULL, 0); + + return (0); +} |