Fixed a lingering portal session when connection was closed uncleanly. This could in some situations lead to out-of-sync sessions in MULTISESSION_MODE=2.

This commit is contained in:
Griatch 2013-05-21 15:05:10 +02:00
parent efdb954491
commit 60068771c7

View file

@ -434,6 +434,10 @@ class PortalSessionHandler(SessionHandler):
Called from portal side when the connection is closed from the portal side. Called from portal side when the connection is closed from the portal side.
""" """
sessid = session.sessid sessid = session.sessid
if sessid in self.sessions:
del self.sessions[sessid]
del session
# tell server to also delete this session
self.portal.amp_protocol.call_remote_ServerAdmin(sessid, self.portal.amp_protocol.call_remote_ServerAdmin(sessid,
operation=PDISCONN) operation=PDISCONN)
@ -473,7 +477,7 @@ class PortalSessionHandler(SessionHandler):
to sync on all sessions to sync on all sessions
""" """
to_save = [sessid for sessid in serversessions if sessid in self.sessions] to_save = [sessid for sessid in serversessions if sessid in self.sessions]
to_delete = [sessid for sessid in serversessions if sessid not in to_save] to_delete = [sessid for sessid in self.sessions if sessid not in to_save]
# save protocols # save protocols
for sessid in to_save: for sessid in to_save:
self.sessions[sessid].load_sync_data(serversessions[sessid]) self.sessions[sessid].load_sync_data(serversessions[sessid])