-# Copyright (c) 2010 Nicira Networks
+# Copyright (c) 2010, 2011 Nicira Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
% (fsm.name, (now - fsm.state_entered) / 1000.0))
return DISCONNECT
- class Reconnect:
+ class Reconnect(object):
name = "RECONNECT"
is_connected = False
% self.name)
else:
if self.passive:
- type = "listen"
+ type_ = "listen"
else:
- type = "connection"
+ type_ = "connection"
if error > 0:
logging.warning("%s: %s attempt failed (%s)"
- % (self.name, type, os.strerror(error)))
+ % (self.name, type_, os.strerror(error)))
else:
self.info_level("%s: %s attempt timed out"
- % (self.name, type))
+ % (self.name, type_))
if (self.state in (Reconnect.Active, Reconnect.Idle)):
self.last_disconnected = now
def timeout(self, now):
"""Returns the number of milliseconds after which self.run() should be
- called if nothing else notable happens in the meantime, or a negative
- number if this is currently unnecessary."""
+ called if nothing else notable happens in the meantime, or None if this
+ is currently unnecessary."""
deadline = self.state.deadline(self)
if deadline is not None:
remaining = deadline - now