[ovs-dev] [PATCH 1/2] python: Honor zero probe interval in reconnect.py

Ben Pfaff blp at nicira.com
Fri Apr 13 22:53:25 UTC 2012


On Wed, Apr 11, 2012 at 10:02:09PM -0700, Ethan Jackson wrote:
> 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 at nicira.com>

I think that this changes the Idle state so that, if there is no
probe interval, the deadline never expires.  That doesn't make sense
to me, because if we've got no probe interval then we should never
enter the Idle state:
> @@ -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):

But this looks like the real fix, to prevent the Idle state from ever
being entered if there is no probe interval (because Active.deadline()
returns None in this case):
> @@ -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

So, if you just make the second change, does it still fix the problem?

Thanks,

Ben.



More information about the dev mailing list