def connect(self): """Start connection to remote server.""" if self.state != "disconnected": raise RuntimeError, "can't connect in this state" self.state = "connecting" if not self.factoryStarted: self.factory.doStart() self.factoryStarted = 1 self.transport = transport = self._makeTransport() if self.timeout is not None: self.timeoutID = self.reactor.callLater(self.timeout, transport.failIfNotConnected, error.TimeoutError()) self.factory.startedConnecting(self)
def _timeoutZone(self, d, controller, connector, seconds): connector.disconnect() controller.timeoutCall = None controller.deferred = None d.errback(error.TimeoutError("Timeout after %ds" % (seconds, )))
def outgoingConnectionFailed(self): """ The connection never got anywhere. Goodbye. """ # XXX CONNECTOR API OMFG self.factory.clientConnectionFailed(None, error.TimeoutError())
def timeoutConnection(self): """When a timeout occurs, kill the process and record a TimeoutError. """ self.unexpectedError(failure.Failure(error.TimeoutError()))
def _timeout(self, user_defer): '''Handles a deferred timeout.''' if not user_defer.called: user_defer.errback(error.TimeoutError('Server did not respond.'))
def sendTimeout(self, df, req): if df.called: log.debug("Request already finished") return else: self.sendError(error.TimeoutError(), req)
def handle_disconnected_connect(self): self.state = "connecting" if not self.factoryStarted: self.factory.doStart() self.factoryStarted = True if self.timeout is not None: self.timeoutID = self.reactor.callLater(self.timeout, self.connectionFailed, failure.Failure(error.TimeoutError())) self.sub = _SubConnector(self) self.sub.startConnecting() self.factory.startedConnecting(self)
def transition_SYN_SENT_to_CLOSED(self): """ The connection never got anywhere. Goodbye. """ # XXX CONNECTOR API OMFG self.factory.clientConnectionFailed(None, error.TimeoutError())