From e60a6d8ad37fce3772d57cfa142155d0935446a7 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 13 Oct 2009 06:14:09 +0000 Subject: When a session is unattached, reset its activity timer to prevent it locking instantly when reattached. --- usr.bin/tmux/server.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'usr.bin/tmux') diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index ad1bcf5e421..6de31ef2835 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.58 2009/10/12 09:29:58 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.59 2009/10/13 06:14:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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); -- cgit v1.2.3