Making explicit which address and port are for Ursula's DHT interface.

pull/155/head
jMyles 2018-02-06 17:16:21 -08:00
parent cc80a065e0
commit c6d050aca7
3 changed files with 6 additions and 6 deletions

View File

@ -448,8 +448,8 @@ class Ursula(Character):
self._rest_app = App(routes=routes) self._rest_app = App(routes=routes)
def listen(self, port, interface): def listen(self, port, interface):
self.port = port self.dht_port = port
self.interface = interface self.dht_interface = interface
return self.server.listen(port, interface) return self.server.listen(port, interface)
def dht_interface_info(self): def dht_interface_info(self):
@ -465,8 +465,8 @@ class Ursula(Character):
def interface_hrac(self): def interface_hrac(self):
return self.hash(msgpack.dumps(self.dht_interface_info())) return self.hash(msgpack.dumps(self.dht_interface_info()))
def publish_interface_information(self): def publish_dht_information(self):
if not self.port and self.interface: if not self.dht_port and self.dht_interface:
raise RuntimeError("Must listen before publishing interface information.") raise RuntimeError("Must listen before publishing interface information.")
dht_key = self.interface_dht_key() dht_key = self.interface_dht_key()

View File

@ -47,7 +47,7 @@ def alice(ursulas):
ALICE.attach_server() ALICE.attach_server()
ALICE.server.listen(8471) ALICE.server.listen(8471)
ALICE.__resource_id = b"some_resource_id" ALICE.__resource_id = b"some_resource_id"
EVENT_LOOP.run_until_complete(ALICE.server.bootstrap([("127.0.0.1", u.port) for u in ursulas])) EVENT_LOOP.run_until_complete(ALICE.server.bootstrap([("127.0.0.1", u.dht_port) for u in ursulas]))
return ALICE return ALICE

View File

@ -43,7 +43,7 @@ def make_ursulas(how_many_ursulas: int, ursula_starting_port: int) -> list:
for _counter, ursula in enumerate(URSULAS): for _counter, ursula in enumerate(URSULAS):
event_loop.run_until_complete( event_loop.run_until_complete(
ursula.server.bootstrap([("127.0.0.1", ursula_starting_port + _c) for _c in range(how_many_ursulas)])) ursula.server.bootstrap([("127.0.0.1", ursula_starting_port + _c) for _c in range(how_many_ursulas)]))
ursula.publish_interface_information() ursula.publish_dht_information()
return URSULAS return URSULAS