summaryrefslogtreecommitdiff
path: root/src/sman.cpp
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:44 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:44 +0200
commitb3a99e6e15af3be25394e66d1138bb2682f565c3 (patch)
tree0206b0018cd075cc8b0d8d4f34a1d27c38598f36 /src/sman.cpp
parent5b7605790328c6c0f473296df444d0f4a79ac779 (diff)
tagging ychat-0.5.5ychat-0.5.5
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;
}