memory: handle the case where an existing session ID is re-used for creating a new session

This commit is contained in:
souliane 2014-09-22 20:26:40 +02:00
commit ccaa5412c5

View file

@ -57,6 +57,9 @@ class Sessions(object):
"""
if session_id is None:
session_id = str(uuid4())
elif session_id in self._sessions:
self._sessions[session_id][0].cancel()
log.warning("Session [{id}] is going to be re-initialised".format(id=session_id))
timer = reactor.callLater(self.timeout, self._purgeSession, session_id)
if session_data is None:
session_data = {}