Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Ensure Dialer.Dial has the right peer #22

Merged
merged 2 commits into from
Dec 9, 2017
Merged

Conversation

jackkleeman
Copy link
Contributor

This solves https://github.com/libp2p/go-libp2p/137 by ensuring that we have the right peer when the connection is established.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

Thanks!

dial.go Outdated
connRemote := connOut.RemotePeer()
if connRemote != remote {
connOut.Close()
_, err := connOut.Read(nil) // should return any potential errors (ex: from secio)
Copy link
Member

Choose a reason for hiding this comment

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

This really shouldn't be necessary. At this point, the secio handshake has completed successfully (we just might not be connected to the right peer).

We should probably log the error from Close(), if anything.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants