From e74d2a7d0143f73de36e21209cb07eee13217c96 Mon Sep 17 00:00:00 2001 From: meejah Date: Sun, 4 Mar 2018 20:08:11 -0700 Subject: [PATCH] get rid of redundant 'introducer_clients' var --- src/allmydata/client.py | 20 ++++++-------------- src/allmydata/test/no_network.py | 1 - src/allmydata/test/test_multi_introducers.py | 8 ++++---- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/allmydata/client.py b/src/allmydata/client.py index fc4f8dd28..0f7b5b43d 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -233,7 +233,7 @@ def create_client_from_config(config, _client_factory=None): ) control_tub = node.create_control_tub() - introducer_clients, introducer_furls = create_introducer_clients(config, main_tub) + introducer_clients = create_introducer_clients(config, main_tub) storage_broker = create_storage_farm_broker( config, default_connection_handlers, foolscap_connection_handlers, tub_options, introducer_clients @@ -246,7 +246,6 @@ def create_client_from_config(config, _client_factory=None): i2p_provider, tor_provider, introducer_clients, - introducer_furls, storage_broker, tub_is_listening=is_listening, ) @@ -271,16 +270,10 @@ def _sequencer(config): def create_introducer_clients(config, main_tub): """ - returns a 2-tuple containing two lists: introducer_clients, - introducer_furls + :returns: a list of IntroducerClient instances """ - # (probably makes sense to return a list of 2-tuples instead of a - # 2-tuple of lists, but keeping variable names etc from when this - # was self.init_introducer_clients in Node) - - # Returns both of these: + # we return this list introducer_clients = [] - introducer_furls = [] introducers_yaml_filename = config.get_private_path("introducers.yaml") introducers_filepath = FilePath(introducers_yaml_filename) @@ -327,8 +320,8 @@ def create_introducer_clients(config, main_tub): introducer_cache_filepath, ) introducer_clients.append(ic) - introducer_furls.append(introducer['furl']) - return introducer_clients, introducer_furls + # introducer_furls.append(introducer['furl']) + return introducer_clients def create_storage_farm_broker(config, default_connection_handlers, foolscap_connection_handlers, tub_options, introducer_clients): @@ -380,7 +373,7 @@ class _Client(node.Node, pollmixin.PollMixin): "max_segment_size": 128*KiB, } - def __init__(self, config, main_tub, control_tub, i2p_provider, tor_provider, introducer_clients, introducer_furls, + def __init__(self, config, main_tub, control_tub, i2p_provider, tor_provider, introducer_clients, storage_farm_broker, tub_is_listening): """ Use create_client() to instantiate one of these. @@ -393,7 +386,6 @@ class _Client(node.Node, pollmixin.PollMixin): self.encoding_params = self.DEFAULT_ENCODING_PARAMETERS.copy() self.introducer_clients = introducer_clients - self.introducer_furls = introducer_furls # appears completely unused (but for tests?) self.storage_broker = storage_farm_broker self.init_stats_provider() diff --git a/src/allmydata/test/no_network.py b/src/allmydata/test/no_network.py index fa6f19912..7a70d1aae 100644 --- a/src/allmydata/test/no_network.py +++ b/src/allmydata/test/no_network.py @@ -200,7 +200,6 @@ def create_no_network_client(basedir): i2p_provider=None, tor_provider=None, introducer_clients=[], - introducer_furls=[], storage_farm_broker=storage_broker, tub_is_listening=True, ) diff --git a/src/allmydata/test/test_multi_introducers.py b/src/allmydata/test/test_multi_introducers.py index 06e057037..4c37cb5b0 100644 --- a/src/allmydata/test/test_multi_introducers.py +++ b/src/allmydata/test/test_multi_introducers.py @@ -83,7 +83,7 @@ class MultiIntroTests(unittest.TestCase): # get a client and first introducer_furl myclient = yield create_client(self.basedir) - tahoe_cfg_furl = myclient.introducer_furls[0] + tahoe_cfg_furl = myclient.introducer_clients[0].introducer_furl # assertions self.failUnlessEqual(fake_furl, tahoe_cfg_furl) @@ -142,14 +142,14 @@ class NoDefault(unittest.TestCase): }} self.yaml_path.setContent(yamlutil.safe_dump(connections)) myclient = yield create_client(self.basedir) - tahoe_cfg_furl = myclient.introducer_furls[0] + tahoe_cfg_furl = myclient.introducer_clients[0].introducer_furl self.assertEquals(tahoe_cfg_furl, 'furl1') @defer.inlineCallbacks def test_real_yaml(self): self.yaml_path.setContent(SIMPLE_YAML) myclient = yield create_client(self.basedir) - tahoe_cfg_furl = myclient.introducer_furls[0] + tahoe_cfg_furl = myclient.introducer_clients[0].introducer_furl self.assertEquals(tahoe_cfg_furl, 'furl1') @defer.inlineCallbacks @@ -167,7 +167,7 @@ class NoDefault(unittest.TestCase): connections = {'introducers': {} } self.yaml_path.setContent(yamlutil.safe_dump(connections)) myclient = yield create_client(self.basedir) - self.assertEquals(len(myclient.introducer_furls), 0) + self.assertEquals(len(myclient.introducer_clients), 0) if __name__ == "__main__": unittest.main()