2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-15 14:17:18 +00:00

python: Honor zero probe interval in reconnect.py

The python reconnect library attempted to send a probe every 0
milliseconds instead of disabling probing when the probe_interval
was zero.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
This commit is contained in:
Ethan Jackson
2012-04-11 20:42:01 -07:00
parent 3d792b703f
commit bceb55c8ba
2 changed files with 10 additions and 3 deletions

View File

@@ -112,7 +112,9 @@ class Reconnect(object):
@staticmethod
def deadline(fsm):
return fsm.state_entered + fsm.probe_interval
if fsm.probe_interval:
return fsm.state_entered + fsm.probe_interval
return None
@staticmethod
def run(fsm, now):
@@ -504,7 +506,9 @@ class Reconnect(object):
connection is indeed in working order. (This will only be
returned if the "probe interval" is nonzero--see
self.set_probe_interval())."""
if now >= self.state.deadline(self):
deadline = self.state.deadline(self)
if deadline is not None and now >= deadline:
return self.state.run(self, now)
else:
return None