From c4f8bf6ce1e9e676438fb0d5f826fd8cdc6d61d4 Mon Sep 17 00:00:00 2001 From: Alex Haynes Date: Wed, 24 Apr 2019 20:59:22 -0400 Subject: [PATCH] fixed requested changes --- libp2p/__init__.py | 8 ++++---- libp2p/kademlia/routed_host.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libp2p/__init__.py b/libp2p/__init__.py index ae13c3a..2e1cf88 100644 --- a/libp2p/__init__.py +++ b/libp2p/__init__.py @@ -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()) diff --git a/libp2p/kademlia/routed_host.py b/libp2p/kademlia/routed_host.py index b7634f2..45fc0c6 100644 --- a/libp2p/kademlia/routed_host.py +++ b/libp2p/kademlia/routed_host.py @@ -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)