def _deactivate(method):
    def deactivate(self):
        try:
            method(self)
        finally:
            try:
                self.socket.shutdown(SHUT_RDWR)
            except (EOFError, __HOLE__):
                pass

            if not self.is_active:
                self.socket.close()
    return deactivate
dataset/ETHPy150Open osrg/ryu/ryu/controller/controller.py/_deactivate