Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Add context option to disable dialing when opening a new stream #116

Merged
merged 4 commits into from
Apr 10, 2019

Conversation

vyzo
Copy link
Contributor

@vyzo vyzo commented Apr 10, 2019

This is essential for (non active) relays who under no circumstances want to initiate a dial to a peer.

It was necessitated by the discovery of a large number of goroutines doing recursive dialing in a relay.

@vyzo vyzo requested a review from Stebalien April 10, 2019 17:25
@ghost ghost assigned vyzo Apr 10, 2019
@ghost ghost added the status/in-progress In progress label Apr 10, 2019
swarm.go Outdated
var ErrNoConn = errors.New("no usable connection to peer")

// ContextOption is the type of context options understood by the swarm
type ContextOption string
Copy link
Member

Choose a reason for hiding this comment

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

Nit: This should probably be a newtype of struct{}.

Also, we should probably put this in go-libp2p-net. Now that we're using go modules, this should be easy (:tada:)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They need to be comparable, whatever that implies. Also the example in godoc uses a string alias type, so I went with it.

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'll update go-libp2p-net to provide the option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to go-libp2p-net in libp2p/go-libp2p-net#42

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 the nodial option in go-libp2p-net.

@vyzo vyzo dismissed Stebalien’s stale review April 10, 2019 19:34

stebalien approced on slack while on mobile.

@vyzo
Copy link
Contributor Author

vyzo commented Apr 10, 2019

@Stebalien LGTM'ed on mobile; merging.

@vyzo vyzo merged commit 51da4b6 into master Apr 10, 2019
@ghost ghost removed the status/in-progress In progress label Apr 10, 2019
@vyzo vyzo deleted the feat/no-dial-option branch April 10, 2019 19:35
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