Commit 3c044d23 authored by Brian Tiger Chow's avatar Brian Tiger Chow

pass as param

parent 8e6e2db9
...@@ -199,12 +199,7 @@ func (bs *bitswap) sendWantlistToPeers(ctx context.Context, peers <-chan peer.ID ...@@ -199,12 +199,7 @@ func (bs *bitswap) sendWantlistToPeers(ctx context.Context, peers <-chan peer.ID
return bs.sendWantlistMsgToPeers(ctx, message, peers) return bs.sendWantlistMsgToPeers(ctx, message, peers)
} }
func (bs *bitswap) sendWantlistToProviders(ctx context.Context) { func (bs *bitswap) sendWantlistToProviders(ctx context.Context, entries []wantlist.Entry) {
entries := bs.wantlist.Entries()
if len(entries) == 0 {
log.Debug("No entries in wantlist, skipping send routine.")
return
}
ctx, cancel := context.WithCancel(ctx) ctx, cancel := context.WithCancel(ctx)
defer cancel() defer cancel()
...@@ -268,7 +263,10 @@ func (bs *bitswap) clientWorker(parent context.Context) { ...@@ -268,7 +263,10 @@ func (bs *bitswap) clientWorker(parent context.Context) {
for { for {
select { select {
case <-broadcastSignal: // resend unfulfilled wantlist keys case <-broadcastSignal: // resend unfulfilled wantlist keys
bs.sendWantlistToProviders(ctx) entries := bs.wantlist.Entries()
if len(entries) > 0 {
bs.sendWantlistToProviders(ctx, entries)
}
broadcastSignal = time.After(rebroadcastDelay.Get()) broadcastSignal = time.After(rebroadcastDelay.Get())
case keys := <-bs.batchRequests: case keys := <-bs.batchRequests:
if len(keys) == 0 { if len(keys) == 0 {
......
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