Commit 08733c2b authored by Jeromy Johnson's avatar Jeromy Johnson Committed by GitHub

Merge pull request #4317 from ipfs/feat/remove-bsnet-todo

NewStream now creates a connection if necessary
parents d840f67e d727a75e
......@@ -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