From 46572b22412a8439fe168f59d027a30e3204a4d4 Mon Sep 17 00:00:00 2001 From: Daniel Kohler <11864045+ddkohler@users.noreply.github.com> Date: Fri, 10 Nov 2023 11:52:18 -0600 Subject: [PATCH] Update _protocol.py --- yaqd-core/yaqd_core/_protocol.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yaqd-core/yaqd_core/_protocol.py b/yaqd-core/yaqd_core/_protocol.py index 311eec5..6644a08 100644 --- a/yaqd-core/yaqd_core/_protocol.py +++ b/yaqd-core/yaqd_core/_protocol.py @@ -18,6 +18,7 @@ def __init__(self, daemon, *args, **kwargs): def connection_lost(self, exc): peername = self.transport.get_extra_info("peername") self.logger.info(f"Connection lost from {peername} to {self._daemon.name}") + self.task.cancel() self._daemon._connection_lost(peername) def connection_made(self, transport): @@ -27,8 +28,7 @@ def connection_made(self, transport): self.transport = transport self.unpacker = avrorpc.Unpacker(self._avro_protocol) self._daemon._connection_made(peername) - task = asyncio.get_event_loop().create_task(self.process_requests()) - self._daemon._tasks.append(task) + self.task = asyncio.get_event_loop().create_task(self.process_requests()) def data_received(self, data): """Process an incomming request."""