def _stop(self, exit_exc=None, caller=None):
        if self._stopped:
            return

        self._stopped = True
        self._rloop.kill(block=True)
        self._wloop.kill(block=True)

        # handle clean disconnection from client
        try:
            self.sock.shutdown(socket.SHUT_RDWR)
        except socket.error:
            pass
        try:
            self.fp.close()
        except (socket.error, __HOLE__):
            pass
        try:
            self.sock.close()
        except (socket.error, AttributeError):
            pass

        self.server.remove_client(self)
        self.logger.info("Closing connection for client {}".format(self._id))
dataset/ETHPy150Open simplecrypto/powerpool/powerpool/server.py/GenericClient._stop