def shutdown(self):
        s = self._sock
        if self._sock is None:
            return
        self._sock = None
        try:
            s.shutdown(socket.SHUT_RDWR)
        except:
            pass
        try:
            s.close()
        except:
            pass