diff --git a/exchange/bitswap/bitswap.go b/exchange/bitswap/bitswap.go index 500817b0a915f5e4714c036c6a2865f07f71e6ff..1a4ec73cf342a57e9d838be5d990f8af45379a0b 100644 --- a/exchange/bitswap/bitswap.go +++ b/exchange/bitswap/bitswap.go @@ -369,10 +369,12 @@ func (bs *bitswap) wantNewBlocks(ctx context.Context, bkeys []u.Key) { message.AddEntry(k, kMaxPriority-i) } for _, p := range bs.engine.Peers() { - err := bs.send(ctx, p, message) - if err != nil { - log.Debugf("Error sending message: %s", err) - } + go func(p peer.ID) { + err := bs.send(ctx, p, message) + if err != nil { + log.Debugf("Error sending message: %s", err) + } + }(p) } }