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
This commit is contained in:
Tomasz Sowa 2011-02-18 09:33:15 +00:00
parent c8a57f2046
commit ca5421347a
3 changed files with 11 additions and 2 deletions

View File

@ -15,8 +15,13 @@
Session::Session() Session::Session()
{ {
SetTimeToNow();
Clear(); Clear();
}
void Session::SetTimeToNow()
{
time = std::time(0); time = std::time(0);
tm_time = Time(time); tm_time = Time(time);
@ -28,6 +33,7 @@ Session::Session()
} }
// this doesn't clear times
void Session::Clear() void Session::Clear()
{ {
id = 0; id = 0;

View File

@ -65,6 +65,7 @@ struct Session
Session(); Session();
void SetTimeToNow();
void Clear(); void Clear();
}; };

View File

@ -111,6 +111,7 @@ void SessionManager::CreateSession()
int attempts = 100; int attempts = 100;
bool added = false; bool added = false;
new_session.SetTimeToNow();
new_session.Clear(); new_session.Clear();
if( config->session_max == 0 || session_tab.Size() < config->session_max ) 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 // there is a problem with generating a new session id
// we do not set a session cookie // we do not set a session cookie
session = &temporary_session; 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 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; log << log1 << "SM: cannot create a session id (temporary used: with id 0)" << logend;
} }