mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-27 00:58:56 +01:00
Don't update activity time twice for new sessions, and add some logging.
This commit is contained in:
parent
d0505fd042
commit
ca5e6bf5f2
10
session.c
10
session.c
@ -131,10 +131,6 @@ session_create(const char *name, int argc, char **argv, const char *path,
|
||||
memcpy(s->tio, tio, sizeof *s->tio);
|
||||
}
|
||||
|
||||
if (gettimeofday(&s->creation_time, NULL) != 0)
|
||||
fatal("gettimeofday failed");
|
||||
session_update_activity(s, &s->creation_time);
|
||||
|
||||
s->sx = sx;
|
||||
s->sy = sy;
|
||||
|
||||
@ -151,6 +147,8 @@ session_create(const char *name, int argc, char **argv, const char *path,
|
||||
}
|
||||
RB_INSERT(sessions, &sessions, s);
|
||||
|
||||
log_debug("new session %s $%u", s->name, s->id);
|
||||
|
||||
if (gettimeofday(&s->creation_time, NULL) != 0)
|
||||
fatal("gettimeofday failed");
|
||||
session_update_activity(s, &s->creation_time);
|
||||
@ -265,6 +263,10 @@ session_update_activity(struct session *s, struct timeval *from)
|
||||
else
|
||||
memcpy(&s->activity_time, from, sizeof s->activity_time);
|
||||
|
||||
log_debug("session %s activity %lld.%06d (last %lld.%06d)", s->name,
|
||||
(long long)s->activity_time.tv_sec, (int)s->activity_time.tv_usec,
|
||||
(long long)last->tv_sec, (int)last->tv_usec);
|
||||
|
||||
if (evtimer_initialized(&s->lock_timer))
|
||||
evtimer_del(&s->lock_timer);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user