aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-17 17:36:55 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-17 17:36:55 +0000
commitf3edf28b7c333ced51775c5f7f0b1a96db61dcf5 (patch)
tree695181651e1bd707a15818b4aab4c5c03d4a8117 /server.c
parent1237025d99bd6b774bc89926f7c129bf4ade69a9 (diff)
downloadrtmux-f3edf28b7c333ced51775c5f7f0b1a96db61dcf5.tar.gz
rtmux-f3edf28b7c333ced51775c5f7f0b1a96db61dcf5.tar.bz2
rtmux-f3edf28b7c333ced51775c5f7f0b1a96db61dcf5.zip
Don't die when last window either.
Diffstat (limited to 'server.c')
-rw-r--r--server.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/server.c b/server.c
index 8460629d..cf084db5 100644
--- a/server.c
+++ b/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.104 2009-01-16 00:12:58 nicm Exp $ */
+/* $Id: server.c,v 1.105 2009-01-17 17:36:55 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -193,6 +193,8 @@ server_main(const char *srv_path, int srv_fd)
last = time(NULL);
+ sigterm=1;/*XXX*/
+
pfds = NULL;
while (!sigterm) {
/* Initialise pollfd array. */
@@ -597,9 +599,13 @@ server_handle_client(struct client *c)
/* Process keys. */
prefix = options_get_number(&c->session->options, "prefix");
- while (tty_keys_next(&c->tty, &key) == 0) {
+ while (tty_keys_next(&c->tty, &key) == 0) {
server_activity = time(NULL);
+ if (c->session == NULL)
+ return;
+ wp = c->session->curw->window->active; /* could die - do each loop */
+
server_clear_client_message(c);
if (c->prompt_string != NULL) {
status_prompt_key(c, key);
@@ -607,7 +613,6 @@ server_handle_client(struct client *c)
}
if (server_locked)
continue;
- wp = c->session->curw->window->active; /* could die - do each loop */
/* No previous prefix key. */
if (!(c->flags & CLIENT_PREFIX)) {
@@ -657,6 +662,8 @@ server_handle_client(struct client *c)
/* Dispatch the command. */
key_bindings_dispatch(bd, c);
}
+ if (c->session == NULL)
+ return;
wp = c->session->curw->window->active; /* could die - do each loop */
/* Ensure the cursor is in the right place and correctly on or off. */