diff libervia.tac @ 45:7f106052326f

server side: user is now disconnected on session end, and queue is purged
author Goffi <goffi@goffi.org>
date Wed, 25 May 2011 15:45:16 +0200
parents 2744dd31e8a5
children c3ee630914ba
line wrap: on
line diff
--- a/libervia.tac	Wed May 25 14:24:41 2011 +0200
+++ b/libervia.tac	Wed May 25 15:45:16 2011 +0200
@@ -273,6 +273,18 @@
             error (_('/!\\ Session has already a profile, this should NEVER happen !'))
         sat_session.profile = profile
         self.sat_host.prof_connected.add(profile)
+        
+        def onExpire():
+            try:
+                #We purge the queue
+                del self.sat_host.signal_handler.queue[profile]
+            except KeyError:
+                pass
+            #and now we deconnect the profile
+            self.sat_host.bridge.disconnect(profile) 
+       
+        _session.notifyOnExpire(onExpire)
+        
         d = defer.Deferred()
         self.sat_host.bridge.getMblogNodes(profile, d.callback, d.errback)
         d.addCallback(self._fillMblogNodes, _session)
@@ -314,7 +326,7 @@
         self.register=None
         self.sat_host=sat_host
         self.signalDeferred = {}
-        self.queue = {} #XXX: gof: don't forgot to purge queue on session end
+        self.queue = {}
 
     def plugRegister(self, register):
         self.register = register