Skip to content

RoutedHost: NewStream ensures we have the means to connect to the peer #208

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

Merged
merged 2 commits into from
Jul 23, 2017

Conversation

vyzo
Copy link
Contributor

@vyzo vyzo commented Jul 21, 2017

Fixes #207

@daviddias daviddias added the status/in-progress In progress label Jul 21, 2017
@vyzo vyzo mentioned this pull request Jul 21, 2017
}
rh.Peerstore().AddAddrs(p, addrs, pstore.TempAddrTTL)
}

Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason to not just call Connect? We'll end up calling Connect on the host again from within NewStream but that should be a no-op.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can safely use connect too, although it's redundant once we've put the addresses in the Peerstore.
Note that BasicHost doesn't call connect explicitly; instead the connection is established by Dial when it sees that it has no active connections.

Copy link
Contributor Author

@vyzo vyzo Jul 22, 2017

Choose a reason for hiding this comment

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

it's 5 lines -vs- 3 when using Connect, so I am opting for it; needs a good comment though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use Connect; so yeah, both shorter and easier to understand with the right comment.

Copy link
Contributor

@whyrusleeping whyrusleeping left a comment

Choose a reason for hiding this comment

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

This is a great catch, thanks @vyzo 👍

@vyzo vyzo changed the title RoutedHost: NewStram ensures we have the means to connect to the peer RoutedHost: NewStream ensures we have the means to connect to the peer Jul 23, 2017
@vyzo vyzo merged commit 41207db into master Jul 23, 2017
@daviddias daviddias removed the status/in-progress In progress label Jul 23, 2017
@vyzo vyzo deleted the fix/routed/peer-addrs branch July 23, 2017 06:32
marten-seemann pushed a commit that referenced this pull request Aug 17, 2022
This drops the opensensus dependency. Nobody uses this, from what I can
tell.

fixes #58
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.

4 participants