From 9294cb099ff371998055410bb3cfd7be0a518368 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 13 Oct 2009 06:14:08 +0000 Subject: [PATCH] When a session is unattached, reset its activity timer to prevent it locking instantly when reattached. --- server.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server.c b/server.c index 2906fb87..6fdcf940 100644 --- a/server.c +++ b/server.c @@ -1377,6 +1377,11 @@ server_lock_server(void) if ((s = ARRAY_ITEM(&sessions, i)) == NULL) continue; + if (s->flags & SESSION_UNATTACHED) { + s->activity = time(NULL); + continue; + } + timeout = options_get_number(&s->options, "lock-after-time"); if (timeout <= 0 || t <= s->activity + timeout) return; /* not timed out */ @@ -1400,6 +1405,11 @@ server_lock_sessions(void) if ((s = ARRAY_ITEM(&sessions, i)) == NULL) continue; + if (s->flags & SESSION_UNATTACHED) { + s->activity = time(NULL); + continue; + } + timeout = options_get_number(&s->options, "lock-after-time"); if (timeout > 0 && t > s->activity + timeout) { server_lock_session(s);