2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Clear lastpayload explicitly in some contexts

It was detected that sometimes lastpayload could get 'stuck',
with no facility to clear it

Change-Id: I0fc0753373233a817926f33c9623b3b5be93b59f
This commit is contained in:
Jarrod Johnson 2018-10-11 17:29:26 -04:00
parent 82e015edb2
commit 4972f01246

View File

@ -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