2
0
mirror of https://opendev.org/x/pyghmi synced 2025-03-19 09:57:43 +00:00

Fix potential for loop on mark_broken.

If a session is doing a best-effort 'logout' due
to a mark_broken scenario, do not activate the
timeout logic, which will cause it to endlessly
recurse into itself.

Change-Id: I9b84d3138f161cc982dd1107586d31be68523108
This commit is contained in:
Jarrod Johnson 2019-11-15 10:31:54 -05:00
parent 114e908947
commit 2311bc9f0b

View File

@ -560,7 +560,7 @@ class Session(object):
self.kgo)]
except KeyError:
pass
self.logout()
self.logout(False)
self.logging = False
self.errormsg = error
if not self.broken:
@ -1770,13 +1770,14 @@ class Session(object):
self.expiration = self.timeout + _monotonic_time()
Session.waiting_sessions[self]['timeout'] = self.expiration
def logout(self):
def logout(self, sessionok=True):
if not self.logged:
return {'success': True}
if self.cleaningup:
self.nowait = True
if self.sol_handler:
self.raw_command(netfn=6, command=0x49, data=(1, 1, 0, 0, 0, 0))
self.raw_command(netfn=6, command=0x49, data=(1, 1, 0, 0, 0, 0),
retry=sessionok)
self.raw_command(command=0x3c,
netfn=6,
data=struct.unpack("4B",