Skip to content

Commit

Permalink
Update _protocol.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkohler committed Nov 10, 2023
1 parent 2735e4e commit 46572b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions yaqd-core/yaqd_core/_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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."""
Expand Down

0 comments on commit 46572b2

Please sign in to comment.