2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-20 19:23:23 +00:00

Do not claim a broken session is valid

Also traverse the directediowaiter list in reverse, to avoid
index referring to wrong value as it goes.

Change-Id: Id8ffa4795b0d90f0cf1db59a271b1ec21d2dafea
This commit is contained in:
Jarrod Johnson 2018-08-16 14:44:12 -04:00
parent 24f847049f
commit fb44c47d40

@ -125,7 +125,8 @@ def define_worker():
# if they have expired, wake them now to let them
# process their timeout
rightnow = _monotonic_time()
for idx, w in enumerate(list(directediowaiters[d])):
for idx, w in reversed(list(
enumerate(directediowaiters[d]))):
ltimeout = w[0] - rightnow
if ltimeout < 0:
w[1].set() # time is up, wake the caller
@ -413,7 +414,7 @@ class Session(object):
if sess['timeout'] < _monotonic_time() - 15:
# session would have timed out by now, don't use it
return False
return True
return not session.broken
def __new__(cls,
bmc,