mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-21 02:01:31 +00:00
Remove these reactor parameters
This commit is contained in:
parent
fcbe56ba0a
commit
4b1c6a2815
@ -270,7 +270,7 @@ def create_client_from_config(config, _client_factory=None, _introducer_factory=
|
||||
|
||||
i2p_provider = create_i2p_provider(reactor, config)
|
||||
tor_provider = create_tor_provider(reactor, config)
|
||||
handlers = node.create_connection_handlers(reactor, config, i2p_provider, tor_provider)
|
||||
handlers = node.create_connection_handlers(config, i2p_provider, tor_provider)
|
||||
default_connection_handlers, foolscap_connection_handlers = handlers
|
||||
tub_options = node.create_tub_options(config)
|
||||
|
||||
|
@ -70,7 +70,7 @@ def create_introducer(basedir=u"."):
|
||||
i2p_provider = create_i2p_provider(reactor, config)
|
||||
tor_provider = create_tor_provider(reactor, config)
|
||||
|
||||
default_connection_handlers, foolscap_connection_handlers = create_connection_handlers(reactor, config, i2p_provider, tor_provider)
|
||||
default_connection_handlers, foolscap_connection_handlers = create_connection_handlers(config, i2p_provider, tor_provider)
|
||||
tub_options = create_tub_options(config)
|
||||
|
||||
# we don't remember these because the Introducer doesn't make
|
||||
|
@ -616,7 +616,7 @@ def _make_tcp_handler():
|
||||
return default()
|
||||
|
||||
|
||||
def create_default_connection_handlers(reactor, config, handlers):
|
||||
def create_default_connection_handlers(config, handlers):
|
||||
"""
|
||||
:return: A dictionary giving the default connection handlers. The keys
|
||||
are strings like "tcp" and the values are strings like "tor" or
|
||||
@ -661,7 +661,7 @@ def create_default_connection_handlers(reactor, config, handlers):
|
||||
return default_connection_handlers
|
||||
|
||||
|
||||
def create_connection_handlers(reactor, config, i2p_provider, tor_provider):
|
||||
def create_connection_handlers(config, i2p_provider, tor_provider):
|
||||
"""
|
||||
:returns: 2-tuple of default_connection_handlers, foolscap_connection_handlers
|
||||
"""
|
||||
@ -681,7 +681,6 @@ def create_connection_handlers(reactor, config, i2p_provider, tor_provider):
|
||||
umid="PuLh8g",
|
||||
)
|
||||
return create_default_connection_handlers(
|
||||
reactor,
|
||||
config,
|
||||
handlers,
|
||||
), handlers
|
||||
|
@ -22,7 +22,7 @@ class TCP(unittest.TestCase):
|
||||
"no-basedir",
|
||||
BASECONFIG,
|
||||
)
|
||||
_, foolscap_handlers = create_connection_handlers(None, config, mock.Mock(), mock.Mock())
|
||||
_, foolscap_handlers = create_connection_handlers(config, mock.Mock(), mock.Mock())
|
||||
self.assertIsInstance(
|
||||
foolscap_handlers['tcp'],
|
||||
tcp.DefaultTCP,
|
||||
@ -341,7 +341,7 @@ class Connections(unittest.TestCase):
|
||||
self.config = config_from_string("fake.port", self.basedir, BASECONFIG)
|
||||
|
||||
def test_default(self):
|
||||
default_connection_handlers, _ = create_connection_handlers(None, self.config, mock.Mock(), mock.Mock())
|
||||
default_connection_handlers, _ = create_connection_handlers(self.config, mock.Mock(), mock.Mock())
|
||||
self.assertEqual(default_connection_handlers["tcp"], "tcp")
|
||||
self.assertEqual(default_connection_handlers["tor"], "tor")
|
||||
self.assertEqual(default_connection_handlers["i2p"], "i2p")
|
||||
@ -352,7 +352,7 @@ class Connections(unittest.TestCase):
|
||||
"no-basedir",
|
||||
BASECONFIG + "[connections]\ntcp = tor\n",
|
||||
)
|
||||
default_connection_handlers, _ = create_connection_handlers(None, config, mock.Mock(), mock.Mock())
|
||||
default_connection_handlers, _ = create_connection_handlers(config, mock.Mock(), mock.Mock())
|
||||
|
||||
self.assertEqual(default_connection_handlers["tcp"], "tor")
|
||||
self.assertEqual(default_connection_handlers["tor"], "tor")
|
||||
@ -368,7 +368,7 @@ class Connections(unittest.TestCase):
|
||||
)
|
||||
with self.assertRaises(ValueError) as ctx:
|
||||
tor_provider = create_tor_provider(reactor, self.config)
|
||||
default_connection_handlers, _ = create_connection_handlers(None, self.config, mock.Mock(), tor_provider)
|
||||
default_connection_handlers, _ = create_connection_handlers(self.config, mock.Mock(), tor_provider)
|
||||
self.assertEqual(
|
||||
str(ctx.exception),
|
||||
"'tahoe.cfg [connections] tcp='"
|
||||
@ -383,7 +383,7 @@ class Connections(unittest.TestCase):
|
||||
BASECONFIG + "[connections]\ntcp = unknown\n",
|
||||
)
|
||||
with self.assertRaises(ValueError) as ctx:
|
||||
create_connection_handlers(None, config, mock.Mock(), mock.Mock())
|
||||
create_connection_handlers(config, mock.Mock(), mock.Mock())
|
||||
self.assertIn("'tahoe.cfg [connections] tcp='", str(ctx.exception))
|
||||
self.assertIn("uses unknown handler type 'unknown'", str(ctx.exception))
|
||||
|
||||
@ -393,7 +393,7 @@ class Connections(unittest.TestCase):
|
||||
"no-basedir",
|
||||
BASECONFIG + "[connections]\ntcp = disabled\n",
|
||||
)
|
||||
default_connection_handlers, _ = create_connection_handlers(None, config, mock.Mock(), mock.Mock())
|
||||
default_connection_handlers, _ = create_connection_handlers(config, mock.Mock(), mock.Mock())
|
||||
self.assertEqual(default_connection_handlers["tcp"], None)
|
||||
self.assertEqual(default_connection_handlers["tor"], "tor")
|
||||
self.assertEqual(default_connection_handlers["i2p"], "i2p")
|
||||
@ -408,7 +408,7 @@ class Privacy(unittest.TestCase):
|
||||
)
|
||||
|
||||
with self.assertRaises(PrivacyError) as ctx:
|
||||
create_connection_handlers(None, config, mock.Mock(), mock.Mock())
|
||||
create_connection_handlers(config, mock.Mock(), mock.Mock())
|
||||
|
||||
self.assertEqual(
|
||||
str(ctx.exception),
|
||||
@ -423,7 +423,7 @@ class Privacy(unittest.TestCase):
|
||||
BASECONFIG + "[connections]\ntcp = disabled\n" +
|
||||
"[node]\nreveal-IP-address = false\n",
|
||||
)
|
||||
default_connection_handlers, _ = create_connection_handlers(None, config, mock.Mock(), mock.Mock())
|
||||
default_connection_handlers, _ = create_connection_handlers(config, mock.Mock(), mock.Mock())
|
||||
self.assertEqual(default_connection_handlers["tcp"], None)
|
||||
|
||||
def test_tub_location_auto(self):
|
||||
|
@ -91,7 +91,7 @@ def testing_tub(config_data=''):
|
||||
|
||||
i2p_provider = create_i2p_provider(reactor, config)
|
||||
tor_provider = create_tor_provider(reactor, config)
|
||||
handlers = create_connection_handlers(reactor, config, i2p_provider, tor_provider)
|
||||
handlers = create_connection_handlers(config, i2p_provider, tor_provider)
|
||||
default_connection_handlers, foolscap_connection_handlers = handlers
|
||||
tub_options = create_tub_options(config)
|
||||
|
||||
@ -936,9 +936,9 @@ class Configuration(unittest.TestCase):
|
||||
|
||||
|
||||
|
||||
class CreateConnectionHandlers(unittest.TestCase):
|
||||
class CreateDefaultConnectionHandlersTests(unittest.TestCase):
|
||||
"""
|
||||
Tests for create_connection_handlers().
|
||||
Tests for create_default_connection_handlers().
|
||||
"""
|
||||
|
||||
def test_tcp_disabled(self):
|
||||
@ -949,9 +949,7 @@ class CreateConnectionHandlers(unittest.TestCase):
|
||||
[connections]
|
||||
tcp = disabled
|
||||
"""))
|
||||
reactor = object() # it's not actually used?!
|
||||
default_handlers = create_default_connection_handlers(
|
||||
reactor,
|
||||
config,
|
||||
{},
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user