def connectionLost(self, reason): """Clean up and let the superclass handle it.""" Telnet.connectionLost(self, reason) LineOnlyReceiver.connectionLost(self, reason) #flush out the buffer if self._buffer: self.lineReceived(self._buffer) self.factory.realm.connectionLost()
def connectionLost(self,reason): print(self) if reason.check(twisted.internet.error.ConnectionDone): print('%s: connection closed.' % self.name) else: print('%s: connection lost: %s' % (self.name,reason)) self.connectedSince = None return Receiver.connectionLost(self,reason)
def connectionLost(self, reason): print(self) if reason.check(twisted.internet.error.ConnectionDone): print('%s: connection closed.' % self.name) else: print('%s: connection lost: %s' % (self.name, reason)) self.connectedSince = None return Receiver.connectionLost(self, reason)
def connectionLost(self, reason): """When TCP connection is lost, remove shutdown handler """ if reason.type == ConnectionLost: msg = 'Disconnected' else: msg = 'Disconnected: %s' % reason.getErrorMessage() self.log.debug(msg) #Remove connect timeout if set if self.connectTimeoutDelayedCall is not None: self.log.debug("Cancelling connect timeout after TCP connection was lost") self.connectTimeoutDelayedCall.cancel() self.connectTimeoutDelayedCall = None #Callback for failed connect if self.connectedDeferred: if self.connectError: self.log.debug("Calling connectedDeferred errback: %s" % self.connectError) self.connectedDeferred.errback(self.connectError) self.connectError = None else: self.log.error("Connection lost with outstanding connectedDeferred") error = StompError("Unexpected connection loss") self.log.debug("Calling connectedDeferred errback: %s" % error) self.connectedDeferred.errback(error) self.connectedDeferred = None #Callback for disconnect if self.disconnectedDeferred: if self.disconnectError: #self.log.debug("Calling disconnectedDeferred errback: %s" % self.disconnectError) self.disconnectedDeferred.errback(self.disconnectError) self.disconnectError = None else: #self.log.debug("Calling disconnectedDeferred callback") self.disconnectedDeferred.callback(self) self.disconnectedDeferred = None LineOnlyReceiver.connectionLost(self, reason)
def connectionLost(self, reason): self.connected = 0 self.closed_d.callback(0) logger.debug('<TelegrafProtocol.connectionLost> %s %s', reason, self) LineOnlyReceiver.connectionLost(self)