Skip to content

Conversation

@darkdragon-001
Copy link
Contributor

@darkdragon-001 darkdragon-001 commented Jan 2, 2026

Previously, a single future was used and any package which was received before the future was awaited was silently discarded (note that there is no else clause in the following code):

def datagram_received(self, data, addr):
if self.recvfrom and not self.recvfrom.done():
self.recvfrom.set_result((data, addr))
def error_received(self, exc): # pragma: no cover
if self.recvfrom and not self.recvfrom.done():
self.recvfrom.set_exception(exc)

Using a queue to correctly handle all incoming datagrams in the socket.

IIUC this is already handled correctly in the trio backend.

Previously, a single future was used and any package which was received before the future was awaited was silently discarded.
@rthalley
Copy link
Owner

rthalley commented Jan 2, 2026

A nice improvement!

@rthalley rthalley merged commit 4026551 into rthalley:main Jan 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants