Sukun
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
0 additions and
3 deletions
-
p2p/host/basic/basic_host.go
|
|
@ -629,9 +629,6 @@ func (h *BasicHost) RemoveStreamHandler(pid protocol.ID) { |
|
|
|
// to create one. If ProtocolID is "", writes no header.
|
|
|
|
// (Thread-safe)
|
|
|
|
func (h *BasicHost) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error) { |
|
|
|
// Ensure we have a connection, with peer addresses resolved by the routing system (#207)
|
|
|
|
// It is not sufficient to let the underlying host connect, it will most likely not have
|
|
|
|
// any addresses for the peer without any prior connections.
|
|
|
|
// If the caller wants to prevent the host from dialing, it should use the NoDial option.
|
|
|
|
if nodial, _ := network.GetNoDial(ctx); !nodial { |
|
|
|
err := h.Connect(ctx, peer.AddrInfo{ID: p}) |
|
|
|