From 4972f012464855d5a8a9aa77fa79f32d2bd1de05 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 11 Oct 2018 17:29:26 -0400 Subject: [PATCH] Clear lastpayload explicitly in some contexts It was detected that sometimes lastpayload could get 'stuck', with no facility to clear it Change-Id: I0fc0753373233a817926f33c9623b3b5be93b59f --- pyghmi/ipmi/private/session.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 1a34c7ef..db9eef79 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -540,6 +540,7 @@ class Session(object): def _mark_broken(self, error=None): # since our connection has failed retries # deregister our keepalive facility + self.lastpayload = none with util.protect(KEEPALIVE_SESSIONS): Session.keepalive_sessions.pop(self, None) with util.protect(WAITING_SESSIONS): @@ -699,6 +700,8 @@ class Session(object): stillin = self.incommand - _monotonic_time() if stillin > 0: return stillin + else: + self.lastpayload = None return 0 def _getmaxtimeout(self): @@ -1655,6 +1658,7 @@ class Session(object): self._mark_broken() return elif self.sessioncontext == 'FAILED': + self.lastpayload = None self.nowait = False return if self.sessioncontext == 'OPENSESSION': @@ -1746,6 +1750,7 @@ class Session(object): struct.pack("I", self.sessionid)), retry=False) # stop trying for a keepalive, + self.lastpayload = None with util.protect(KEEPALIVE_SESSIONS): Session.keepalive_sessions.pop(self, None) self.logged = 0