Skip to content

Refactored RoutedHost into Injected Router#157

Merged
alexh merged 11 commits intomasterfrom
router-refactor
May 5, 2019
Merged

Refactored RoutedHost into Injected Router#157
alexh merged 11 commits intomasterfrom
router-refactor

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
@pacrob pacrob deleted the router-refactor branch November 21, 2024 19:02
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