def fire(self): """Fire the timer.""" assert self.isReady() self._next = simtime.now() + self._cur_delay self._cur_delay *= self._multiplier self.fireAction()
def __init__(self, node): # tornet.Node instance self._node = node # True iff we have marked this node as down. self._markedDown = False # True iff we have marked this node as up. self._markedUp = False # True iff we've attempted to connect to this node. self._tried = False # When did we add it (simulated)? self._addedAt = simtime.now() # True iff the node is listed as a guard in the most recent consensus self._listed = True
def isReady(self): """Return true iff the timer is ready to fire now.""" if self._paused: return False return self._next <= simtime.now()
def addedWithin(self, nSec): """Return ``True`` iff this guard was added within the last **nSec** simulated seconds. """ return self._addedAt + nSec >= simtime.now()
def isReady(self): """Return true iff the timer is ready to fire now.""" return self._next <= simtime.now()
def addedWithin(self, nSec): """Return true iff this guard was added within the last 'nSec' simulated seconds.""" return self._addedAt + nSec >= simtime.now()