Commit a247e24c authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

fix(bitswap) always use prvivate `send` method to send

cc @whyrusleeping
parent 05c10446
...@@ -182,23 +182,10 @@ func (bs *bitswap) sendWantListTo(ctx context.Context, peers <-chan peer.PeerInf ...@@ -182,23 +182,10 @@ func (bs *bitswap) sendWantListTo(ctx context.Context, peers <-chan peer.PeerInf
wg.Add(1) wg.Add(1)
go func(p peer.ID) { go func(p peer.ID) {
defer wg.Done() defer wg.Done()
if err := bs.send(ctx, p, message); err != nil {
log.Event(ctx, "DialPeer", p) log.Error(err)
err := bs.sender.DialPeer(ctx, p)
if err != nil {
log.Errorf("Error sender.DialPeer(%s): %s", p, err)
return
}
err = bs.sender.SendMessage(ctx, p, message)
if err != nil {
log.Errorf("Error sender.SendMessage(%s) = %s", p, err)
return return
} }
// FIXME ensure accounting is handled correctly when
// communication fails. May require slightly different API to
// get better guarantees. May need shared sequence numbers.
bs.engine.MessageSent(p, message)
}(peerToQuery.ID) }(peerToQuery.ID)
} }
wg.Wait() wg.Wait()
......
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