2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-15 04:07:48 +00:00

Fix raw_command hang when externally 'broken' or 'logged out'

When something requests logout in the middle of a command request,
bail out with 'session no longer connected' rather than infinite loop
waiting for lastresponse which should never come.

Change-Id: I9a8592a72b687f90bc044bbe48fd87d79b35d780
This commit is contained in:
Jarrod Johnson 2015-10-28 10:35:33 -04:00
parent 9b6e6b9ba0
commit f6386e42fa

View File

@ -626,10 +626,12 @@ class Session(object):
#of only the constructor needing a callback. From then on,
#synchronous usage of the class acts in a greenthread style governed by
#order of data on the network
while retry and self.lastresponse is None:
while retry and self.lastresponse is None and self.logged:
Session.wait_for_rsp(timeout=timeout)
lastresponse = self.lastresponse
self.incommand = False
if lastresponse is None:
raise exc.IpmiException('Session no longer connected')
return lastresponse
def _send_ipmi_net_payload(self, netfn=None, command=None, data=[], code=0,