From 39fed50071855fdc4aefe841a3025e4705d37a11 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 4 Feb 2019 11:36:14 -0800 Subject: [PATCH] add no_listen=False to Manager and Dilator This is only used by tests so far (and will simplify the integration test that hasn't landed yet), but is not yet wired up to Boss, so there's no way for applications to enable it yet. --- src/wormhole/_dilation/manager.py | 5 +++-- src/wormhole/test/dilate/test_manager.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/wormhole/_dilation/manager.py b/src/wormhole/_dilation/manager.py index ad74e92..feee725 100644 --- a/src/wormhole/_dilation/manager.py +++ b/src/wormhole/_dilation/manager.py @@ -97,7 +97,7 @@ class Manager(object): _reactor = attrib(repr=False) _eventual_queue = attrib(repr=False) _cooperator = attrib(repr=False) - _no_listen = False # TODO + _no_listen = attrib(default=False) _tor = None # TODO _timing = None # TODO _next_subchannel_id = None # initialized in choose_role @@ -466,6 +466,7 @@ class Dilator(object): _reactor = attrib() _eventual_queue = attrib() _cooperator = attrib() + _no_listen = attrib(default=False) def __attrs_post_init__(self): self._got_versions_d = Deferred() @@ -509,7 +510,7 @@ class Dilator(object): self._transit_key, self._transit_relay_location, self._reactor, self._eventual_queue, - self._cooperator) + self._cooperator, no_listen=self._no_listen) self._manager.start() while self._pending_inbound_dilate_messages: diff --git a/src/wormhole/test/dilate/test_manager.py b/src/wormhole/test/dilate/test_manager.py index e223a1c..ee31c5e 100644 --- a/src/wormhole/test/dilate/test_manager.py +++ b/src/wormhole/test/dilate/test_manager.py @@ -64,7 +64,7 @@ class TestDilator(unittest.TestCase): dil.got_wormhole_versions({"can-dilate": ["1"]}) # that should create the Manager self.assertEqual(ml.mock_calls, [mock.call(send, "us", transit_key, - None, reactor, eq, coop)]) + None, reactor, eq, coop, no_listen=False)]) # and tell it to start, and get wait-for-it-to-connect Deferred self.assertEqual(m.mock_calls, [mock.call.start(), mock.call.when_first_connected(), @@ -180,7 +180,7 @@ class TestDilator(unittest.TestCase): return_value="us"): dil.got_wormhole_versions({"can-dilate": ["1"]}) self.assertEqual(ml.mock_calls, [mock.call(send, "us", b"key", - None, reactor, eq, coop)]) + None, reactor, eq, coop, no_listen=False)]) self.assertEqual(m.mock_calls, [mock.call.start(), mock.call.rx_PLEASE(pleasemsg), mock.call.rx_HINTS(hintmsg), @@ -198,7 +198,7 @@ class TestDilator(unittest.TestCase): return_value="us"): dil.got_wormhole_versions({"can-dilate": ["1"]}) self.assertEqual(ml.mock_calls, [mock.call(send, "us", b"key", - relay, reactor, eq, coop), + relay, reactor, eq, coop, no_listen=False), mock.call().start(), mock.call().when_first_connected()])