From ca5421347a1569fec7c6ec11a01c63ef5a702ad8 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Fri, 18 Feb 2011 09:33:15 +0000 Subject: [PATCH] fixed: a new created session doesn't have a correct time set git-svn-id: svn://ttmath.org/publicrep/winix/trunk@719 e52654a7-88a9-db11-a3e9-0013d4bc506e --- core/session.cpp | 8 +++++++- core/session.h | 1 + core/sessionmanager.cpp | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/session.cpp b/core/session.cpp index 0f1fd48..32c0bb8 100755 --- a/core/session.cpp +++ b/core/session.cpp @@ -15,8 +15,13 @@ Session::Session() { + SetTimeToNow(); Clear(); - +} + + +void Session::SetTimeToNow() +{ time = std::time(0); tm_time = Time(time); @@ -28,6 +33,7 @@ Session::Session() } +// this doesn't clear times void Session::Clear() { id = 0; diff --git a/core/session.h b/core/session.h index 6dcf760..c417ea6 100755 --- a/core/session.h +++ b/core/session.h @@ -65,6 +65,7 @@ struct Session Session(); + void SetTimeToNow(); void Clear(); }; diff --git a/core/sessionmanager.cpp b/core/sessionmanager.cpp index 5873b84..2e36048 100755 --- a/core/sessionmanager.cpp +++ b/core/sessionmanager.cpp @@ -111,6 +111,7 @@ void SessionManager::CreateSession() int attempts = 100; bool added = false; + new_session.SetTimeToNow(); new_session.Clear(); if( config->session_max == 0 || session_tab.Size() < config->session_max ) @@ -137,7 +138,8 @@ bool added = false; // there is a problem with generating a new session id // we do not set a session cookie session = &temporary_session; - session->Clear(); + session->SetTimeToNow(); + session->Clear(); // !! uwaga ten Clear wyczysci plugins data session->new_session = false; // temporary session was initialized at the beginning log << log1 << "SM: cannot create a session id (temporary used: with id 0)" << logend; }