From fb44c47d404a017263a55eadb911dd2625d3169e Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 16 Aug 2018 14:44:12 -0400 Subject: [PATCH] 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 --- pyghmi/ipmi/private/session.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index f8893156..c906b9b7 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -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,