'Cleans up the socket.'

def connectionLost(self, reason):

    self._logConnectionLostMsg()
    self._realPortNumber = None
    base.BasePort.connectionLost(self, reason)
    self.connected = False
    self._closeSocket(True)
    del self.socket
    del self.fileno
    try:
        self.factory.doStop()
    finally:
        self.disconnecting = False
