X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=python%2Fovs%2Freconnect.py;h=459957302fa8b2ac57adef901cea37db53e7c280;hb=7cfb9651a2cd446d81fce90ccf77af56d5c0cbc2;hp=a6ecc39b32710ece063efb850072d19f0c5c44fa;hpb=3a656eafb96ab8a474e943baabdb2679d0a6b0ef;p=openvswitch diff --git a/python/ovs/reconnect.py b/python/ovs/reconnect.py index a6ecc39b..45995730 100644 --- a/python/ovs/reconnect.py +++ b/python/ovs/reconnect.py @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2011 Nicira Networks +# Copyright (c) 2010, 2011, 2012 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,13 +15,14 @@ import os import ovs.vlog +import ovs.util # Values returned by Reconnect.run() CONNECT = 'connect' DISCONNECT = 'disconnect' PROBE = 'probe' -EOF = -1 +EOF = ovs.util.EOF vlog = ovs.vlog.Vlog("reconnect") @@ -111,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): @@ -503,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