-
Notifications
You must be signed in to change notification settings - Fork 35
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
Replace dead peers & increase replacement cache size #59
Conversation
ping @Stebalien @aschmahmann |
table.go
Outdated
|
||
if !notEmpty { | ||
log.Infof("failed to replace missing peer=%s as all candidates were invalid", p) | ||
} |
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.
Are we doing anything with the replacement peer?
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.
- peer to be replaced -> we use it to calculate the CPL. But, we can just pass in the CPL in the channel rather than the peer.
- The peer we replace with -> we just "validate it". The way things are wried right now, a side effect of the validation is that that the peer gets added to the RT because of the DHT connectedness notification handler. I've documented that in the
cleanup
function. Should I document it here as well ?
There is a bigger issue here. If we are already connected to a candidate, we wont add it to the RT because the connected notification in the DHT will not fire for it. |
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.
Most of the Info
log statements here should be Debug
. Other than that, LGTM with some nits.
table_cleanup.go
Outdated
i := rt.bucketIdForPeer(pinfo.Id) | ||
if rt.buckets[i].getPeer(pinfo.Id) != nil { | ||
log.Infof("successfully validated missing peer=%s, marking it as active", pinfo.Id) | ||
rt.addPeer(pinfo.Id) |
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.
Can't we just set the peer state to active here instead of calling addPeer
?
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.
Done.
} | ||
|
||
// replaces a peer using a valid peer from the replacement cache | ||
func (rt *RoutingTable) startPeerReplacement() { |
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.
Do we need another goroutine or can we just have a single "run" goroutine?
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.
Replacement is also requested by the DHT in addition to the cleanup routine. What do you have in mind when you say have a single "run" go-routine ?
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.
I mean merge the cleanup and replacement goroutines to reduce the number fo components updating the routing table. But it's not really an important change.
Have changed the logs to Debug. |
@Stebalien @aschmahmann
For #58.
goprocess
lib completely as just context is fine here.