-
Notifications
You must be signed in to change notification settings - Fork 233
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
Conversation
536626e
to
fececcc
Compare
@@ -69,6 +71,13 @@ var Defaults = func(o *Options) error { | |||
return nil | |||
} | |||
|
|||
func RoutingTableLatencyTolerance(latency time.Duration) Option { |
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.
Could you add some documentation for this function ?
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.
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 |
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.
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.
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.
Yeah, sure.
@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/. |
@aarshkshah1992 I've made the requested changes, could you take a look? |
LGTM. Thanks ! |
No description provided.