From 62211a05df8b2921907f93aedac27dcb26c87702 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 16 Jul 2018 11:18:38 -0400 Subject: [PATCH] Provide a grace period for session validity If a session has *just* expired, it may just be waiting for the next timeout pass. If it expired 15 seconds ago, however, it should by all rights be beyond dead. This matters as the calling code may be oblivious to the change of session object under the covers if this is tripped. Change-Id: I5be3bafb5932c287eb17c66217ba630746533310 --- pyghmi/ipmi/private/session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 2988e570..4dd4ea92 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -406,7 +406,7 @@ class Session(object): with util.protect(KEEPALIVE_SESSIONS): sess = cls.keepalive_sessions.get(session, None) if sess is not None and 'timeout' in sess: - if sess['timeout'] < _monotonic_time(): + if sess['timeout'] < _monotonic_time() - 15: # session would have timed out by now, don't use it return False return True