From 0826b1bd34206312117cec368b97f3ba9bb18287 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 16 Jul 2007 19:47:42 -0700 Subject: [PATCH] introducer.py: minor rearrangement of methods --- src/allmydata/client.py | 4 ++-- src/allmydata/introducer.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/allmydata/client.py b/src/allmydata/client.py index 7c68ba94..e54e195e 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -139,14 +139,14 @@ class Client(node.Node, Referenceable): def get_all_peerids(self): if not self.introducer_client: return [] - return self.introducer_client.connections.iterkeys() + return self.introducer_client.get_all_peerids() def get_permuted_peers(self, key): """ @return: list of (permuted-peerid, peerid, connection,) """ results = [] - for peerid, connection in self.introducer_client.connections.iteritems(): + for peerid, connection in self.introducer_client.get_all_peers(): assert isinstance(peerid, str) permuted = bytes_to_long(sha.new(key + peerid).digest()) results.append((permuted, peerid, connection)) diff --git a/src/allmydata/introducer.py b/src/allmydata/introducer.py index 668be165..8db66b2d 100644 --- a/src/allmydata/introducer.py +++ b/src/allmydata/introducer.py @@ -123,3 +123,9 @@ class IntroducerClient(service.Service, Referenceable): def connected_to_introducer(self): return self._connected + + def get_all_peerids(self): + return self.connections.iterkeys() + + def get_all_peers(self): + return self.connections.iteritems() -- 2.45.2