-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored RoutedHost into Injected Router #157
Conversation
…into router-refactor
…into router-refactor
…into router-refactor
958c9ae
to
3b1a3fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some minor changes and print statement fixes
libp2p/__init__.py
Outdated
peerstore_opt=peerstore_opt) | ||
peerstore_opt=peerstore_opt, disc_opt=disc_opt) | ||
|
||
swarm_opt.add_router(disc_opt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can take out this line as disc_opt should have been passed into Swarm in Swarm construction at line 83.
libp2p/host/basic_host.py
Outdated
self.peerstore = self.network.peerstore | ||
def __init__(self, network, router=None): | ||
self._network = network | ||
self.peerstore = self._network.peerstore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's place this line after line 17 to look cleaner
async def find_peer(self, peer_id): | ||
""" | ||
Find specific Peer | ||
FindPeer searches for a peer with given peer_id, returns a peer.PeerInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is returning a KadPeerInfo here from decode_peerinfo
As per #153 (comment), RoutedHost has been refactored into a dependency injection IoC model where we inject a router implementing using kademlia DHT into swarm.