From: Brian Warner Date: Tue, 17 Jul 2007 02:47:42 +0000 (-0700) Subject: introducer.py: minor rearrangement of methods X-Git-Url: https://git.rkrishnan.org/configuration.rst?a=commitdiff_plain;h=0826b1bd34206312117cec368b97f3ba9bb18287;p=tahoe-lafs%2Ftahoe-lafs.git introducer.py: minor rearrangement of methods --- 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()