-
Notifications
You must be signed in to change notification settings - Fork 37
Add context option to disable dialing when opening a new stream #116
Conversation
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 |
There was a problem hiding this comment.
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:)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
stebalien approced on slack while on mobile.
@Stebalien LGTM'ed on mobile; merging. |
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.