2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-15 20:27:45 +00:00

Fix infinitely recursing custom keepalives

Custom keepalives are called regardless of whether a command is issued
or not.  The rationale being that custom keepalives are checking for
something specific rather than just assuring session state.  Notably,
SOL uses a custom keepalive to see if the payload is still active.
The resultant problem was that if keepalive expired just at the time
something was in the midst of a command, a session would infinitely
recurse into its own keepalive.  The issue was that the keepalive
expiry incorrectly omitted _monotonic_time, causing expiry to
always be far in the past.  It normally did not break because if
not incommand, send_payload was setting an appropriate value after
the incorrect setting.

Change-Id: Ie86e49890a6ac96ddf07206fb1b8558161c00a20
This commit is contained in:
Jarrod Johnson 2014-06-10 09:22:35 -04:00
parent 37bfae70c4
commit 26e8e4fdf0

View File

@ -922,8 +922,8 @@ class Session(object):
sessionstokeepalive = []
for session, parms in cls.keepalive_sessions.iteritems():
if parms['timeout'] < curtime:
cls.keepalive_sessions[session]['timeout'] = 25 + \
(random.random() * 4.9)
cls.keepalive_sessions[session]['timeout'] = \
_monotonic_time() + 25 + (random.random() * 4.9)
sessionstokeepalive.append(session)
for session in sessionstokeepalive:
session._keepalive()