mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-11 12:06:26 +00:00
Do not let a logout come back round into its own notification
Telling a keepalive that the session is gone can end up back in logout, because reporting it is how a console gives up its claim. The inner pass finished by clearing the register of keepalives while the outer was still walking it, so the next entry was looked up on None. Two entries is what an XCC has, the console's and the oem handler's. Take the callbacks and give up the register before notifying anyone.
This commit is contained in:
@@ -1987,16 +1987,19 @@ class Session(object):
|
||||
self.onlogpayload = None
|
||||
self.logging = False
|
||||
if self._customkeepalives:
|
||||
for ka in list(self._customkeepalives):
|
||||
# Be thorough and notify parties through their custom
|
||||
# keepalives. In practice, this *should* be the same, but
|
||||
# if a code somehow makes duplicate SOL handlers,
|
||||
# this would notify all the handlers rather than just the
|
||||
# last one to take ownership
|
||||
if self._customkeepalives[ka][1] is None:
|
||||
# Be thorough and notify parties through their custom
|
||||
# keepalives. In practice, this *should* be the same, but
|
||||
# if a code somehow makes duplicate SOL handlers,
|
||||
# this would notify all the handlers rather than just the
|
||||
# last one to take ownership
|
||||
# Take the callbacks and give this up first: notifying one can
|
||||
# come back round through here and clear it mid walk
|
||||
callbacks = [ka[1] for ka in self._customkeepalives.values()]
|
||||
self._customkeepalives = None
|
||||
for callback in callbacks:
|
||||
if callback is None:
|
||||
continue
|
||||
await self._customkeepalives[ka][1](
|
||||
{'error': 'Session Disconnected'})
|
||||
await callback({'error': 'Session Disconnected'})
|
||||
self._customkeepalives = None
|
||||
if not self.broken:
|
||||
self.broken = True
|
||||
|
||||
Reference in New Issue
Block a user