summaryrefslogtreecommitdiffstats
path: root/server.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-09-12 13:01:19 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-09-12 13:01:19 +0000
commit8cb8a0da8d061293e9e4b52d99473ff574abf727 (patch)
tree8d21263232347ebdef2453d05a44e5a8c8299297 /server.c
parentd771614d33da54c2028a690079a64c0edb2949fc (diff)
Tidy some common code for destroying sessions into a new function.
Diffstat (limited to 'server.c')
-rw-r--r--server.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/server.c b/server.c
index ce2d984a..09ce8b36 100644
--- a/server.c
+++ b/server.c
@@ -1211,21 +1211,11 @@ server_check_window(struct window *w)
RB_FOREACH(wl, winlinks, &s->windows) {
if (wl->window != w)
continue;
- destroyed = session_detach(s, wl);
- for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
- c = ARRAY_ITEM(&clients, j);
- if (c == NULL || c->session != s)
- continue;
- if (!destroyed) {
- server_redraw_client(c);
- continue;
- }
- c->session = NULL;
- server_write_client(c, MSG_EXIT, NULL, 0);
- }
- /* If the session was destroyed, bail now. */
- if (destroyed)
+ if (session_detach(s, wl)) {
+ server_destroy_session(s);
break;
+ }
+ server_redraw_session(s);
goto restart;
}
}