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

p2p/net/swarm: fix connect self problems #548

Merged
merged 3 commits into from
Jan 13, 2015
Merged

p2p/net/swarm: fix connect self problems #548

merged 3 commits into from
Jan 13, 2015

Conversation

jbenet
Copy link
Member

@jbenet jbenet commented Jan 13, 2015

This adds two checks after a successful conn.Dial

  • if the remote peer is not who we wanted, close conn
  • if the remove peer is outselves, close conn

(the second is redundant, but the codebase may evolve to end up disabling the
first check, so keeping the second in place helps)

note: Loopback addresses are actually sent out (they have to be, in cases
where there are >1 node in the same machine), so many times when trying
connections, nodes end up dialing themselves.

This adds two checks after a successful conn.Dial
* if the remote peer is not who we wanted, close conn
* if the remove peer is outselves, close conn

(the second is redundant, but the codebase may evolve to
end up disabling the first check, so keeping the second
in place helps)

note:
Loopback addresses are actually sent out (they _have to be_,
in cases where there are >1 node in the same machine), so
many times when trying connections, nodes end up dialing
themselves.
@jbenet jbenet added the status/in-progress In progress label Jan 13, 2015
@whyrusleeping
Copy link
Member

LGTM, in the future, we may want to 'sort' the address list, with loopback addresses as the last resort, and normal looking ip's first.

@jbenet
Copy link
Member Author

jbenet commented Jan 13, 2015

@whyrusleeping yeah makes sense. we want good heuristics to pick addrs. sorting is not braindead, so in the future.

@whyrusleeping
Copy link
Member

LGTM still! 👍

jbenet added a commit that referenced this pull request Jan 13, 2015
p2p/net/swarm: fix connect self problems
@jbenet jbenet merged commit 083bd9c into master Jan 13, 2015
@jbenet jbenet removed the status/in-progress In progress label Jan 13, 2015
@jbenet jbenet deleted the fix-connect-self branch January 13, 2015 05:45
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