mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-22 14:22:25 +00:00
introducer: add get_nickname_for_peerid
This commit is contained in:
parent
af07b9cad6
commit
e2c484a761
@ -256,6 +256,8 @@ class Client(node.Node, testutil.PollMixin):
|
|||||||
|
|
||||||
def get_all_peerids(self):
|
def get_all_peerids(self):
|
||||||
return self.introducer_client.get_all_peerids()
|
return self.introducer_client.get_all_peerids()
|
||||||
|
def get_nickname_for_peerid(self, peerid):
|
||||||
|
return self.introducer_client.get_nickname_for_peerid(peerid)
|
||||||
|
|
||||||
def get_permuted_peers(self, service_name, key):
|
def get_permuted_peers(self, service_name, key):
|
||||||
"""
|
"""
|
||||||
|
@ -244,6 +244,14 @@ class IntroducerClient(service.Service, Referenceable):
|
|||||||
for (peerid, service_name, rref)
|
for (peerid, service_name, rref)
|
||||||
in self._connections])
|
in self._connections])
|
||||||
|
|
||||||
|
def get_nickname_for_peerid(self, peerid):
|
||||||
|
for k in self._connectors:
|
||||||
|
(peerid0, svcname0) = k
|
||||||
|
if peerid0 == peerid:
|
||||||
|
rsc = self._connectors[k]
|
||||||
|
return rsc.nickname
|
||||||
|
return None
|
||||||
|
|
||||||
def get_all_connections_for(self, service_name):
|
def get_all_connections_for(self, service_name):
|
||||||
return frozenset([c
|
return frozenset([c
|
||||||
for c in self._connections
|
for c in self._connections
|
||||||
|
@ -247,6 +247,14 @@ class IntroducerClient_V1(service.Service, Referenceable):
|
|||||||
for (peerid, service_name, rref)
|
for (peerid, service_name, rref)
|
||||||
in self._connections])
|
in self._connections])
|
||||||
|
|
||||||
|
def get_nickname_for_peerid(self, peerid):
|
||||||
|
for k in self._connectors:
|
||||||
|
(peerid0, svcname0) = k
|
||||||
|
if peerid0 == peerid:
|
||||||
|
rsc = self._connectors[k]
|
||||||
|
return rsc.nickname
|
||||||
|
return None
|
||||||
|
|
||||||
def get_all_connections_for(self, service_name):
|
def get_all_connections_for(self, service_name):
|
||||||
return frozenset([c
|
return frozenset([c
|
||||||
for c in self._connections
|
for c in self._connections
|
||||||
|
@ -152,6 +152,9 @@ class SystemTest(SystemTestMixin, unittest.TestCase):
|
|||||||
self.failUnlessEqual(len(c.get_all_peerids()), NUMCLIENTS)
|
self.failUnlessEqual(len(c.get_all_peerids()), NUMCLIENTS)
|
||||||
self.failUnlessEqual(len(c.get_all_connections_for("storage")),
|
self.failUnlessEqual(len(c.get_all_connections_for("storage")),
|
||||||
NUMCLIENTS)
|
NUMCLIENTS)
|
||||||
|
nodeid0 = b32decode(tubs[clients[0]].tubID.upper())
|
||||||
|
self.failUnlessEqual(c.get_nickname_for_peerid(nodeid0),
|
||||||
|
"nickname-0")
|
||||||
d.addCallback(_check1)
|
d.addCallback(_check1)
|
||||||
|
|
||||||
origin_c = clients[0]
|
origin_c = clients[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user