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

Extend session keepalive

Since the keepalive is retried, there's no reason to try
to be as frequent as half the specified interval.  The
spec allows inactivity timeout as short as 57 seconds, so
the keepalive interval is extended to 50-55 (allowing some
room for retry to hit in case of dropped packet).

Change-Id: I3b08f2cad1f319759cd0cc54a8793ec16d88d82e
This commit is contained in:
Jarrod Johnson 2016-05-11 13:24:33 -04:00
parent d517799899
commit 8833dcb817

View File

@ -835,7 +835,7 @@ class Session(object):
if (self in Session.keepalive_sessions and not needskeepalive and
not self._customkeepalives):
Session.keepalive_sessions[self]['timeout'] = _monotonic_time() + \
25 + (random.random() * 4.9)
50 + (random.random() * 4.9)
self._xmit_packet(retry, delay_xmit=delay_xmit, timeout=timeout)
def _ipmi15authcode(self, payload, checkremotecode=False):
@ -947,7 +947,7 @@ class Session(object):
Session.keepalive_sessions[self] = {}
Session.keepalive_sessions[self]['ipmisession'] = self
Session.keepalive_sessions[self]['timeout'] = _monotonic_time() + \
25 + (random.random() * 4.9)
50 + (random.random() * 4.9)
self.onlogon({'success': True})
def _get_session_challenge(self):
@ -1074,7 +1074,7 @@ class Session(object):
# until incommand is no longer the case
if parms['timeout'] < curtime and not session._isincommand():
cls.keepalive_sessions[session]['timeout'] = \
_monotonic_time() + 25 + (random.random() * 4.9)
_monotonic_time() + 50 + (random.random() * 4.9)
sessionstokeepalive.append(session)
for session in sessionstokeepalive:
session._keepalive()