fixed requested changes

This commit is contained in:
Alex Haynes 2019-04-24 20:59:22 -04:00
parent 73ce3461e2
commit c4f8bf6ce1
2 changed files with 8 additions and 8 deletions

View File

@ -104,13 +104,13 @@ async def new_node(
id_opt=id_opt, transport_opt=transport_opt,
muxer_opt=muxer_opt, sec_opt=sec_opt,
peerstore_opt=peerstore_opt)
if not disc_opt:
disc_opt = initialize_default_kademlia(ksize=20, alpha=3,
id_opt=id_opt, storage=None)
# TODO enable support for other host type
# TODO routing unimplemented
host = RoutedHost(swarm_opt, disc_opt)
if not disc_opt:
host = BasicHost(swarm_opt)
else:
host = RoutedHost(swarm_opt, disc_opt)
# Kick off cleanup job
asyncio.ensure_future(cleanup_done_tasks())

View File

@ -8,14 +8,14 @@ class RoutedHost(BasicHost):
def get_kad_network(self):
return self.kad_network
def kad_listen(self, port, interface='0.0.0.0'):
def routed_listen(self, port, interface='0.0.0.0'):
return self.kad_network.listen(port, interface)
def kad_get(self, key):
def routed_get(self, key):
return self.kad_network.get(key)
def kad_set(self, key, value):
def routed_set(self, key, value):
return self.kad_network.set(key, value)
def kad_set_digest(self, dkey, value):
def routed_set_digest(self, dkey, value):
return self.kad_network.set_digest(dkey, value)