Skip to content

Commit

Permalink
Merge pull request #4317 from ipfs/feat/remove-bsnet-todo
Browse files Browse the repository at this point in the history
NewStream now creates a connection if necessary
  • Loading branch information
whyrusleeping authored Oct 18, 2017
2 parents d840f67 + d727a75 commit 08733c2
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions exchange/bitswap/network/ipfs_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 08733c2

Please sign in to comment.