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

various identify fixes and nits #922

Merged
merged 12 commits into from
May 14, 2020
Merged

various identify fixes and nits #922

merged 12 commits into from
May 14, 2020

Conversation

Stebalien
Copy link
Member

My fingers got itchy to write some code.

  • Don't cache the identify message, cache the state and re-generate the identify message each time relative to the connection being identified:
    • Always send the correct observed addr for the connection being identified.
    • Always send the correct addresses for the connection being identified by filtering.
      • I'm not sure if this is the right approach, but it matches our current approach.
  • Delta changes
    • 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.

@aarshkshah1992 aarshkshah1992 changed the base branch from feat/identify-races to master May 13, 2020 05:21
aarshkshah1992 and others added 12 commits May 13, 2020 10:54
* 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.
@aarshkshah1992
Copy link
Contributor

(rebased).

@aarshkshah1992
Copy link
Contributor

@Stebalien Good stuff. LGTM !

@aarshkshah1992 aarshkshah1992 merged commit b42ba0f into master May 14, 2020
@aarshkshah1992 aarshkshah1992 deleted the fix/observed-addr branch May 14, 2020 11:54
Comment on lines 194 to 198
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
Copy link
Member

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.

@Stebalien

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in #942

@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.

3 participants