Replace add_reader/add_writer with async socket ops for Windows compatibility#376
Open
Replace add_reader/add_writer with async socket ops for Windows compatibility#376
Conversation
…tibility Replace loop.add_reader()/remove_reader() with async recv loop tasks using loop.sock_recvfrom() for both unicast and multicast sockets. Replace loop.add_writer()/remove_writer() in _async_sendto with loop.sock_sendto(). These asyncio socket methods work on all platforms including Windows' ProactorEventLoop, which does not support add_reader/add_writer. Remove _SKIP_WINDOWS markers from integration tests. Co-authored-by: pavel-kirienko <3298404+pavel-kirienko@users.noreply.github.com>
Co-authored-by: pavel-kirienko <3298404+pavel-kirienko@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix UDPTransport for Windows compatibility
Replace add_reader/add_writer with async socket ops for Windows compatibility
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UDPTransportusedloop.add_reader()/add_writer()which are not supported on Windows'ProactorEventLoop.Changes
add_readercallbacks withasyncio.Taskloops usingloop.sock_recvfrom()(Python 3.11+). Tasks tracked in_unicast_rx_tasksand_mcast_rx_tasksfor lifecycle management.add_writer/remove_writerwritability-wait in_async_sendtowithloop.sock_sendto().close()and_UDPSubjectListener.close()cancel tasks instead of callingremove_reader()._SKIP_WINDOWSmarker from all integration test classes.Before:
After:
Added
asyncio.sleep(0.1)backoff in RX loops on persistentOSErrorto avoid tight-looping (the oldadd_readerapproach was inherently event-gated).Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
239.0.0.10REDACTED, pid is -1(packet block)239.0.0.100REDACTED, pid is -1(packet block)239.0.0.42REDACTED, pid is -1(packet block)239.0.0.50REDACTED, pid is -1(packet block)239.0.0.55REDACTED, pid is -1(packet block)239.0.0.60REDACTED, pid is -1(packet block)239.0.0.7REDACTED, pid is -1(packet block)239.0.0.70REDACTED, pid is -1(packet block)239.0.0.80REDACTED, pid is -1(packet block)239.0.0.99REDACTED, pid is -1(packet block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.