def receiveError(self, reasonCode, description): """ Called when we receive a disconnect error message from the other side. """ error = disconnectErrors.get(reasonCode, DisconnectError) self.connectionClosed(error(reasonCode, description)) SSHClientTransport.receiveError(self, reasonCode, description)
def test_cleanupConnectionImmediately(self): """ L{_NewConnectionHelper.cleanupConnection} closes the transport with C{abortConnection} if called with C{immediate} set to C{True}. """ class Abortable: aborted = False def abortConnection(self): """ Abort the connection. """ self.aborted = True helper = _NewConnectionHelper(None, None, None, None, None, None, None, None, None, None) connection = SSHConnection() connection.transport = SSHClientTransport() connection.transport.transport = Abortable() helper.cleanupConnection(connection, True) self.assertTrue(connection.transport.transport.aborted)
def connectionLost(self, reason): SSHClientTransport.connectionLost(self, reason) self.connectionClosed(reason)