'Cleans up my socket.'

def connectionLost(self, reason=None):

    log.msg(('(Port    %s    Closed)' % repr(self.port)))
    base.BasePort.connectionLost(self, reason)
    if hasattr(self, 'protocol'):
        self.protocol.doStop()
    self.connected = 0
    self.socket.close()
    del self.socket
    del self.fileno
    if hasattr(self, 'd'):
        self.d.callback(None)
        del self.d
