From 472512fe97f1bbb08f4318329b4706cfabf21e38 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 5 Feb 2013 23:25:11 +0100 Subject: [PATCH] Session Cleanup: init timestamp properly. --- webcit/context_loop.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webcit/context_loop.c b/webcit/context_loop.c index 6fab115fa..47c5610f3 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -64,6 +64,7 @@ void do_housekeeping(void) * Lock the session list, moving any candidates for euthanasia into * a separate list. */ + the_time = 0; CtdlLogResult(pthread_mutex_lock(&SessionListMutex)); for (sptr = SessionList; sptr != NULL; sptr = sptr->next) { if (the_time == 0) @@ -212,6 +213,7 @@ wcsession *CreateSession(int Lockable, int Static, wcsession **wclist, ParsedHtt memset(TheSession, 0, sizeof(wcsession)); TheSession->Hdr = Hdr; TheSession->serv_sock = (-1); + TheSession->lastreq = time(NULL);; pthread_setspecific(MyConKey, (void *)TheSession); @@ -492,6 +494,7 @@ void context_loop(ParsedHttpHdrs *Hdr) struct timeval tx_start; struct timeval tx_finish; int session_may_be_reused = 1; + time_t now; gettimeofday(&tx_start, NULL); /* start a stopwatch for performance timing */ @@ -589,11 +592,12 @@ void context_loop(ParsedHttpHdrs *Hdr) /* * Bind to the session and perform the transaction */ + now = time(NULL);; CtdlLogResult(pthread_mutex_lock(&TheSession->SessionMutex)); pthread_setspecific(MyConKey, (void *)TheSession); - TheSession->inuse = 1; /* mark the session as bound */ - TheSession->lastreq = time(NULL); /* log */ + TheSession->inuse = 1; /* mark the session as bound */ + TheSession->lastreq = now; /* log */ TheSession->Hdr = Hdr; /* -- 2.30.2