2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Fix error behavior when target has no SOL session

When a system did not have any custom keep alive, the
code to mark the esssion broken erroneously tries to
dereference.

Change-Id: Ic4efe3c65ee4c09c97ef9f08dc30603c4c15d872
This commit is contained in:
Jarrod Johnson 2016-09-14 13:02:26 -04:00
parent 657b75cc86
commit c35781d4cf

View File

@ -496,14 +496,15 @@ class Session(object):
if self.logged:
self.logged = 0 # mark session as busted
self.logging = False
for ka in list(self._customkeepalives):
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
self._customkeepalives[ka][1](
{'error': 'Session Disconnected'})
self._customkeepalives[ka][1](
{'error': 'Session Disconnected'})
self._customkeepalives = None
if not self.broken:
self.socketpool[self.socket] -= 1