aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-11-04 22:46:25 +0000
committerTiago Cunha <tcunha@gmx.com>2009-11-04 22:46:25 +0000
commit5be38f2b3afbbf8985bad78a9d773730c7b8d009 (patch)
tree68ac4d0394aec6df87a70f8c0d06b826ca9707d0 /server-client.c
parentb7fc4f37603f01efa6984ca510d3378d7eae72a1 (diff)
downloadrtmux-5be38f2b3afbbf8985bad78a9d773730c7b8d009.tar.gz
rtmux-5be38f2b3afbbf8985bad78a9d773730c7b8d009.tar.bz2
rtmux-5be38f2b3afbbf8985bad78a9d773730c7b8d009.zip
Sync OpenBSD patchset 485:
Add an activity time for clients, like for sessions, and change session and client lookup to pick the most recently used rather than the most recently created - this is much more useful when used interactively and (because the activity time is set at creation) should have no effect on source-file. Based on a problem reported by Jan Johansson.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/server-client.c b/server-client.c
index 5a4aff18..4cfc08a2 100644
--- a/server-client.c
+++ b/server-client.c
@@ -1,4 +1,4 @@
-/* $Id: server-client.c,v 1.11 2009-11-04 22:42:31 tcunha Exp $ */
+/* $Id: server-client.c,v 1.12 2009-11-04 22:46:25 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -62,6 +62,7 @@ server_client_create(int fd)
if (gettimeofday(&c->creation_time, NULL) != 0)
fatal("gettimeofday failed");
+ memcpy(&c->activity_time, &c->creation_time, sizeof c->activity_time);
ARRAY_INIT(&c->prompt_hdata);
@@ -286,6 +287,7 @@ server_client_handle_data(struct client *c)
oo = &c->session->options;
/* Update activity timer. */
+ memcpy(&c->activity_time, &tv_now, sizeof c->activity_time);
memcpy(&c->session->activity_time,
&tv_now, sizeof c->session->activity_time);
@@ -582,9 +584,13 @@ server_client_msg_dispatch(struct client *c)
break;
c->flags &= ~CLIENT_SUSPENDED;
- if (c->session != NULL &&
- gettimeofday(&c->session->activity_time, NULL) != 0)
- fatal("gettimeofday failed");
+ if (gettimeofday(&c->activity_time, NULL) != 0)
+ fatal("gettimeofday");
+ if (c->session != NULL) {
+ memcpy(&c->session->activity_time,
+ &c->activity_time,
+ sizeof c->session->activity_time);
+ }
tty_start_tty(&c->tty);
server_redraw_client(c);