From bceb55c8ba91af812bc61e1ebc54f367ad034157 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Wed, 11 Apr 2012 20:42:01 -0700 Subject: [PATCH] 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 --- lib/reconnect.c | 5 ++++- python/ovs/reconnect.py | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/reconnect.c b/lib/reconnect.c index 7737fcf7..c7500070 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 7e58f504..f1da930a 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 -- 2.30.2