summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/platform.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/platform.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/platform.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/platform.py b/packages/meshbay-node/src/meshbay_node/platform.py
index 80aa6ae..2eab9e1 100644
--- a/packages/meshbay-node/src/meshbay_node/platform.py
+++ b/packages/meshbay-node/src/meshbay_node/platform.py
@@ -29,17 +29,23 @@ def force_utf8_stdio() -> None:
def use_compatible_event_loop() -> None:
"""
- aiortc's ICE stack (aioice) does not run on Windows' default
- ProactorEventLoop — a DataChannel handshake never completes and the
- connection hangs. Select the SelectorEventLoop before the loop is created.
+ On Windows, select the SelectorEventLoop: aiortc's ICE stack does not
+ complete a loopback DataChannel handshake on the default ProactorEventLoop.
Cost: SelectorEventLoop cannot spawn subprocesses on Windows, so ffmpeg
streaming (asyncio.create_subprocess_exec in webrtc_server.py) does not work
under it. The video path needs a thread-based runner on Windows — tracked
for the port. No effect off Windows.
+
+ Whether the hang is real for a live peer (vs. the same-process loopback in
+ the tests) is still being established: set MESHBAY_NODE_EVENT_LOOP=proactor
+ to keep the default loop and check.
"""
- if sys.platform == "win32":
- asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
+ if sys.platform != "win32":
+ return
+ if os.environ.get("MESHBAY_NODE_EVENT_LOOP", "").lower() == "proactor":
+ return
+ asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
# ── Directories ──────────────────────────────────────────────────────────────