Commit d727a75e authored by Steven Allen's avatar Steven Allen

NewStream now creates a connection if necessary

License: MIT
Signed-off-by: default avatarSteven Allen <steven@stebalien.com>
parent d840f67e
......@@ -105,14 +105,6 @@ func (bsnet *impl) NewMessageSender(ctx context.Context, p peer.ID) (MessageSend
}
func (bsnet *impl) newStreamToPeer(ctx context.Context, p peer.ID) (inet.Stream, error) {
// first, make sure we're connected.
// if this fails, we cannot connect to given peer.
//TODO(jbenet) move this into host.NewStream?
if err := bsnet.host.Connect(ctx, pstore.PeerInfo{ID: p}); err != nil {
return nil, err
}
return bsnet.host.NewStream(ctx, p, ProtocolBitswap, ProtocolBitswapOne, ProtocolBitswapNoVers)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment