mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-16 16:41:35 +02:00
If a session is destroyed, safely kill all other clients attached to it.
This commit is contained in:
19
session.c
19
session.c
@ -1,4 +1,4 @@
|
||||
/* $Id: session.c,v 1.3 2007-08-27 09:53:38 nicm Exp $ */
|
||||
/* $Id: session.c,v 1.4 2007-08-27 12:05:15 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -119,7 +119,7 @@ session_attach(struct session *s, struct window *w)
|
||||
}
|
||||
|
||||
/* Detach a window from a session. */
|
||||
int
|
||||
void
|
||||
session_detach(struct session *s, struct window *w)
|
||||
{
|
||||
if (s->window == w) {
|
||||
@ -128,13 +128,20 @@ session_detach(struct session *s, struct window *w)
|
||||
}
|
||||
|
||||
window_remove(&s->windows, w);
|
||||
if (ARRAY_EMPTY(&s->windows)) {
|
||||
session_destroy(s);
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Flush session if it is empty. */
|
||||
int
|
||||
session_flush(struct session *s)
|
||||
{
|
||||
if (!ARRAY_EMPTY(&s->windows))
|
||||
return (0);
|
||||
|
||||
session_destroy(s);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Return if session has window. */
|
||||
int
|
||||
session_has(struct session *s, struct window *w)
|
||||
|
Reference in New Issue
Block a user