Skip to content

Commit

Permalink
DatagramServer: Eliminate a possible race condition error
Browse files Browse the repository at this point in the history
  • Loading branch information
francis-clairicia committed Jun 23, 2024
1 parent df84bc1 commit b756126
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/easynetwork/lowlevel/api_async/servers/datagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,10 @@ async def handler(datagram: bytes, address: _T_Address, /) -> None:
client = client_cache[address]
except KeyError:
client_cache[address] = client = _ClientToken(DatagramClientContext(address, self), _ClientData(backend))
new_client_task = True
else:
new_client_task = client.data.state is None

await client.data.push_datagram(datagram)

if new_client_task:
if client.data.state is None:
del datagram
client.data.mark_pending()
await self.__client_coroutine(datagram_received_cb, client, task_group, default_context)
Expand Down

0 comments on commit b756126

Please sign in to comment.