From a51dcdc430150b688d56ec35e8c96ce6f978f68b Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 20 Dec 2010 00:03:55 +0000 Subject: Unify the way sessions are used by callbacks - store the address and use the reference count, then check it is still on the global sessions list in the callback. --- session.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'session.c') diff --git a/session.c b/session.c index 7d3fb32d..c4d553cb 100644 --- a/session.c +++ b/session.c @@ -35,6 +35,18 @@ struct session_groups session_groups; struct winlink *session_next_alert(struct winlink *); struct winlink *session_previous_alert(struct winlink *); +/* + * Find if session is still alive. This is true if it is still on the global + * sessions list. + */ +int +session_alive(struct session *s) +{ + u_int idx; + + return (session_index(s, &idx) == 0); +} + /* Find session by name. */ struct session * session_find(const char *name) -- cgit