From: Ethan Jackson Date: Thu, 12 Apr 2012 03:42:01 +0000 (-0700) Subject: python: Honor zero probe interval in reconnect.py X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=bceb55c8ba91af812bc61e1ebc54f367ad034157;p=ovs.git 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 --- diff --git a/lib/reconnect.c b/lib/reconnect.c index 7737fcf7e..c7500070c 100644 --- a/lib/reconnect.c +++ b/lib/reconnect.c @@ -541,7 +541,10 @@ reconnect_deadline__(const struct reconnect *fsm) return LLONG_MAX; case S_IDLE: - return fsm->state_entered + fsm->probe_interval; + if (fsm->probe_interval) { + return fsm->state_entered + fsm->probe_interval; + } + return LLONG_MAX; case S_RECONNECT: return fsm->state_entered; diff --git a/python/ovs/reconnect.py b/python/ovs/reconnect.py index 7e58f5041..f1da930a7 100644 --- a/python/ovs/reconnect.py +++ b/python/ovs/reconnect.py @@ -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