summaryrefslogtreecommitdiff
path: root/src/sman.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sman.cpp')
-rw-r--r--src/sman.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sman.cpp b/src/sman.cpp
index dd2138f..96c638f 100644
--- a/src/sman.cpp
+++ b/src/sman.cpp
@@ -12,6 +12,7 @@ sman::~sman()
{
delete this->sessions;
}
+
string sman::generateId( int len )
{
string valid_chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
@@ -29,11 +30,18 @@ sess *sman::createSession( )
string new_id=this->generateId(s_tool::string2int( s_conf::get
().get_val( "SESSION_LENGTH" ) ) );
+ sess* p_sess = getSession(new_id);
+
+ // Prove if session id already exists.
+ if (p_sess)
+ return createSession();
+
sess *new_sess= new sess( new_id );
this->sessioncount++;
this->sessions->add_elem( new_sess, new_id );
+
return new_sess;
}