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

Boostrap empty RT and Optimize allocs when we discover new peers #631

Merged
merged 9 commits into from
May 14, 2020

Conversation

aarshkshah1992
Copy link
Contributor

@aarshkshah1992 aarshkshah1992 commented May 8, 2020

@Stebalien

For #387(one part of it) and #594:

  • We bootstrap when we have empty Routing Tables (includes tests for this).
  • Cache protocol strings, use a zero-alloc mutation of SupportProtocols and reduce allocs in RT when we add a new peer.

Please review associated PRs:

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to finish off go-libp2p-core PR but otherwise LGTM. Thanks!

@@ -504,9 +561,6 @@ func (dht *IpfsDHT) peerStoppedDHT(ctx context.Context, p peer.ID) {
// A peer that does not support the DHT protocol is dead for us.
// There's no point in talking to anymore till it starts supporting the DHT protocol again.
dht.routingTable.RemovePeer(p)

// since we lost a peer from the RT, we should do this here
dht.fixRTIfNeeded()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not do this? The idea was to fix our routing table if we drop below some number of peers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the periodic bootstrap will help.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stebalien Should have added a comment here. The dht.routingTable.RemovePeer call will result into a call to the Peer Removed callback which in turns calls fixRTIfNeeded .

@aarshkshah1992
Copy link
Contributor Author

@Stebalien Have made the change in core & peerstore. Thanks !

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge when ready.

@aarshkshah1992 aarshkshah1992 merged commit 08ab423 into master May 14, 2020
@aarshkshah1992 aarshkshah1992 deleted the feat/bootstrap-and-allocs branch May 14, 2020 11:27
@Stebalien Stebalien mentioned this pull request May 26, 2020
77 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