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

Make the Routing Table's latency tolerance configurable. #454

Merged
merged 4 commits into from
Feb 19, 2020

Conversation

vibhavp
Copy link
Contributor

@vibhavp vibhavp commented Feb 17, 2020

No description provided.

@vibhavp vibhavp force-pushed the cfg-routing-table-latency branch from 536626e to fececcc Compare February 17, 2020 14:36
@@ -69,6 +71,13 @@ var Defaults = func(o *Options) error {
return nil
}

func RoutingTableLatencyTolerance(latency time.Duration) Option {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add some documentation for this function ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@@ -99,7 +99,7 @@ func New(ctx context.Context, h host.Host, options ...opts.Option) (*IpfsDHT, er
if err := cfg.Apply(append([]opts.Option{opts.Defaults}, options...)...); err != nil {
return nil, err
}
dht := makeDHT(ctx, h, cfg.Datastore, cfg.Protocols, cfg.BucketSize)
dht := makeDHT(ctx, h, cfg.Datastore, cfg.Protocols, cfg.BucketSize, cfg.RoutingTable.LatencyTolerance)
dht.autoRefresh = cfg.RoutingTable.AutoRefresh
Copy link
Contributor

Choose a reason for hiding this comment

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

While you are on this, would you mind just passing the whole config object to makeDHT and reading in the values there ? IMO, what we have right now isn't really neat.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, sure.

@aarshkshah1992
Copy link
Contributor

aarshkshah1992 commented Feb 18, 2020

@vibhavp Thanks for the PR ! If you are interested in making more contributions to the DHT or libp2p in general, please feel free to ask for any kind of help on freenode IRC at #libp2p or post your comments on https://discuss.libp2p.io/.

@vibhavp
Copy link
Contributor Author

vibhavp commented Feb 19, 2020

@aarshkshah1992 I've made the requested changes, could you take a look?

@aarshkshah1992
Copy link
Contributor

LGTM. Thanks !

@aarshkshah1992 aarshkshah1992 merged commit 5552b3f into libp2p:master Feb 19, 2020
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