-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
various identify fixes and nits #922
Conversation
e8938d2
to
3949a83
Compare
* Always send the correct observed addr for the connection being identified. * Always send the correct addresses for the connection being identified. * Avoid extra work when the remote peer doesn't support identify delta. * Instead of applying delta locally, just update the snapshot with the new protocols. * Always access the snapshot under a lock and get rid of the test channel. This doesn't cost us in terms of performance and makes the system easier to reason about.
3949a83
to
355fd08
Compare
(rebased). |
@Stebalien Good stuff. LGTM ! |
if ids.Host.Network().Connectedness(rp) == network.Connected { | ||
mes := &pb.Identify{} | ||
ids.populateMessage(mes, rp, addReq.localConnAddr, addReq.remoteConnAddr) | ||
ph = newPeerHandler(rp, ids, mes) | ||
ph = newPeerHandler(rp, ids) | ||
ph.start() | ||
phs[rp] = ph | ||
addReq.resp <- ph |
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.
If the peer disconnects between the time when the other goroutine sent into this one and now, we will never respond on the resp channel and we'll have a goroutine leak.
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.
Hm. You're right. We need to send something back then reset the stream, I guess.
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.
Fixed in #942
My fingers got itchy to write some code.