added to config: session_max
how many sessions can be: default 1000000 (one milion) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@694 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -119,6 +119,8 @@ void SessionManager::CreateTemporarySession()
|
||||
else
|
||||
{
|
||||
request->session = &(*i);
|
||||
request->session->Clear(); // !! what about session.plugin_data?
|
||||
request->session->id = 0;
|
||||
request->session->new_session = false;
|
||||
}
|
||||
}
|
||||
@@ -130,23 +132,30 @@ void SessionManager::CreateSession()
|
||||
Session s;
|
||||
int attempts = 100;
|
||||
|
||||
for( ; attempts > 0 ; --attempts )
|
||||
if( config->session_max == 0 || session_tab.Size() < config->session_max - 1 ) // -1 for the temporary session
|
||||
{
|
||||
s.id = CreateSessionId();
|
||||
|
||||
bool added = session_tab.PushBack(s);
|
||||
|
||||
if( added )
|
||||
for( ; attempts > 0 ; --attempts )
|
||||
{
|
||||
request->session = &session_tab.Back();
|
||||
request->session->new_session = true;
|
||||
|
||||
log << log2 << "SM: created a new session: " << request->session->id << logend;
|
||||
s.id = CreateSessionId();
|
||||
|
||||
bool added = session_tab.PushBack(s);
|
||||
|
||||
return;
|
||||
if( added )
|
||||
{
|
||||
request->session = &session_tab.Back();
|
||||
request->session->new_session = true;
|
||||
|
||||
log << log2 << "SM: created a new session: " << request->session->id << logend;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
log << log2 << "SM: sessions limit exceeded (" << config->session_max << ")" << logend;
|
||||
}
|
||||
|
||||
// there is a problem with generating a new session id
|
||||
// we do not set a session cookie
|
||||
CreateTemporarySession();
|
||||
|
Reference in New Issue
Block a user