summaryrefslogtreecommitdiffstats
path: root/server-fn.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-fn.c
parentd771614d33da54c2028a690079a64c0edb2949fc (diff)
Tidy some common code for destroying sessions into a new function.
Diffstat (limited to 'server-fn.c')
-rw-r--r--server-fn.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/server-fn.c b/server-fn.c
index d3cdbd60..d39108dd 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -272,10 +272,7 @@ server_kill_window(struct window *w)
{
struct session *s;
struct winlink *wl;
- struct client *c;
- u_int i, j;
- int destroyed;
-
+ u_int i;
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
s = ARRAY_ITEM(&sessions, i);
@@ -284,23 +281,30 @@ server_kill_window(struct window *w)
if ((wl = winlink_find_by_window(&s->windows, w)) == NULL)
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) {
- c->session = NULL;
- server_write_client(c, MSG_EXIT, NULL, 0);
- } else
- server_redraw_client(c);
- }
+ if (session_detach(s, wl))
+ server_destroy_session(s);
+ else
+ server_redraw_session(s);
}
recalculate_sizes();
}
void
+server_destroy_session(struct session *s)
+{
+ struct client *c;
+ u_int i;
+
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c == NULL || c->session != s)
+ continue;
+ c->session = NULL;
+ server_write_client(c, MSG_EXIT, NULL, 0);
+ }
+}
+
+void
server_set_identify(struct client *c)
{
struct timeval tv;