Commit 499aa2c3 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Jeromy

feat(bitswap) loop over all provided keys

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent 36ebde35
......@@ -182,19 +182,13 @@ func (bs *bitswap) run(ctx context.Context) {
}
}
case ks := <-bs.batchRequests:
// TODO: implement batching on len(ks) > X for some X
if len(ks) == 0 {
log.Warning("Received batch request for zero blocks")
continue
}
for _, k := range ks {
bs.wantlist.Add(k)
}
providers := bs.routing.FindProvidersAsync(ctx, ks[0], maxProvidersPerRequest)
err := bs.sendWantListTo(ctx, providers)
if err != nil {
log.Errorf("error sending wantlist: %s", err)
providers := bs.routing.FindProvidersAsync(ctx, k, maxProvidersPerRequest)
err := bs.sendWantListTo(ctx, providers)
if err != nil {
log.Errorf("error sending wantlist: %s", err)
}
}
case <-ctx.Done():
return
......
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