From d60768b3812f30cf4109e2a5dab498d916262572 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 24 Sep 2026 12:43:47 +0200 Subject: refactor(node): dispatch MNP messages through a table The pre-authentication guards stay explicit code, in the same order and text. After the handshake, a table maps each type to its handler and to whether it runs as a task, the choice each branch made; the three inline blocks become StreamingMixin methods, unchanged. The dispatch golden is identical, including types that are not strings. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-node/tests/test_task_lifetime.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'packages/meshbay-node/tests/test_task_lifetime.py') diff --git a/packages/meshbay-node/tests/test_task_lifetime.py b/packages/meshbay-node/tests/test_task_lifetime.py index a8445fa..6f0abb7 100644 --- a/packages/meshbay-node/tests/test_task_lifetime.py +++ b/packages/meshbay-node/tests/test_task_lifetime.py @@ -249,7 +249,10 @@ def test_chunks_wait_for_room_on_the_channel(session): def test_answering_a_chunk_does_not_block_the_message_loop(session): """It waits for buffer room, and the acks that free it arrive on this loop.""" - assert "self._spawn(self._do_file_request(msg))" in session, ( + from meshbay_common.protocol import MNP + from meshbay_node.transport.webrtc.dispatch import _HANDLERS, SPAWNED + + assert _HANDLERS[MNP.FILE_REQUEST] == ("_do_file_request", SPAWNED), ( "answering inline would stall the uploads whose acks drain the buffer") -- cgit v1.2.3