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.
This commit is contained in:
Brian Warner 2019-02-04 11:36:14 -08:00
parent 64618bcb64
commit 39fed50071
2 changed files with 6 additions and 5 deletions

View File

@ -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:

View File

@ -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()])