def gotPerspective(self, perspective): ReconnectingPBClientFactory.gotPerspective(self, perspective) self.perspective = perspective try: perspective.broker.transport.setTcpKeepAlive(1) except: log.msg("unable to set SO_KEEPALIVE") if not self.keepaliveInterval: self.keepaliveInterval = 10 * 60 self.activity() if self.keepaliveInterval: log.msg("sending application-level keepalives every %d seconds" % self.keepaliveInterval) self.startTimers()
def gotPerspective(self, perspective): ReconnectingPBClientFactory.gotPerspective(self, perspective) self.perspective = perspective try: perspective.broker.transport.setTcpKeepAlive(1) except: log.msg("unable to set SO_KEEPALIVE") if not self.keepaliveInterval: self.keepaliveInterval = 10*60 self.activity() if self.keepaliveInterval: log.msg("sending application-level keepalives every %d seconds" \ % self.keepaliveInterval) self.startTimers()
def gotPerspective(self, perspective): log.msg("connected to FreshCVS daemon") ReconnectingPBClientFactory.gotPerspective(self, perspective) self.source.connected = True # TODO: freshcvs-1.0.10 doesn't handle setFilter correctly, it will # be fixed in the upcoming 1.0.11 . I haven't been able to test it # to make sure the failure mode is survivable, so I'll just leave # this out for now. return if self.source.prefix is not None: pathfilter = "^%s" % self.source.prefix d = perspective.callRemote("setFilter", None, pathfilter, None) # ignore failures, setFilter didn't work in 1.0.10 and this is # just an optimization anyway d.addErrback(lambda f: None)
def clientConnectionLost(self, connector, reason): ReconnectingPBClientFactory.clientConnectionLost( self, connector, reason) self.source.connected = False
def stopFactory(self): ReconnectingPBClientFactory.stopFactory(self) self.stopTimers()
def clientConnectionLost(self, connector, reason): self.connector = None self.stopTimers() self.perspective = None ReconnectingPBClientFactory.clientConnectionLost(self, connector, reason)
def clientConnectionFailed(self, connector, reason): self.connector = None ReconnectingPBClientFactory.clientConnectionFailed(self, connector, reason)
def startedConnecting(self, connector): ReconnectingPBClientFactory.startedConnecting(self, connector) self.connector = connector
def __init__(self, keepaliveInterval, keepaliveTimeout, maxDelay): ReconnectingPBClientFactory.__init__(self) self.maxDelay = maxDelay self.keepaliveInterval = keepaliveInterval self.keepaliveTimeout = keepaliveTimeout
def clientConnectionLost(self, connector, reason): ReconnectingPBClientFactory.clientConnectionLost(self, connector, reason) self.source.connected = False