changeset 1213:b5928601d7aa

memory: handle the case where an existing session ID is re-used for creating a new session
author souliane <souliane@mailoo.org>
date Mon, 22 Sep 2014 20:26:40 +0200
parents 628e320eab1f
children ed3b01ed70d7
files src/memory/memory.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/memory/memory.py	Sun Sep 21 13:10:55 2014 +0200
+++ b/src/memory/memory.py	Mon Sep 22 20:26:40 2014 +0200
@@ -57,6 +57,9 @@
         """
         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 = {}