Skip to content
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

Merged
merged 11 commits into from
May 5, 2019
Merged

Refactored RoutedHost into Injected Router #157

merged 11 commits into from
May 5, 2019

Conversation

alexh
Copy link
Contributor

@alexh alexh commented Apr 25, 2019

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.

Copy link
Contributor

@zixuanzh zixuanzh left a 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

peerstore_opt=peerstore_opt)
peerstore_opt=peerstore_opt, disc_opt=disc_opt)

swarm_opt.add_router(disc_opt)
Copy link
Contributor

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.

self.peerstore = self.network.peerstore
def __init__(self, network, router=None):
self._network = network
self.peerstore = self._network.peerstore
Copy link
Contributor

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
Copy link
Contributor

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

@alexh alexh merged commit eea6a9f into master May 5, 2019
@ntninja ntninja mentioned this pull request Jul 26, 2019
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants