File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -68,11 +68,12 @@ func (bs *Bitswap) provideWorker(ctx context.Context) {
68
68
log .Debug ("provideKeys channel closed" )
69
69
return
70
70
}
71
- ctx , _ := context .WithTimeout (ctx , provideTimeout )
71
+ ctx , cancel := context .WithTimeout (ctx , provideTimeout )
72
72
err := bs .network .Provide (ctx , k )
73
73
if err != nil {
74
74
log .Error (err )
75
75
}
76
+ cancel ()
76
77
case <- ctx .Done ():
77
78
return
78
79
}
@@ -136,12 +137,13 @@ func (bs *Bitswap) clientWorker(parent context.Context) {
136
137
// NB: Optimization. Assumes that providers of key[0] are likely to
137
138
// be able to provide for all keys. This currently holds true in most
138
139
// every situation. Later, this assumption may not hold as true.
139
- child , _ := context .WithTimeout (req .ctx , providerRequestTimeout )
140
+ child , cancel := context .WithTimeout (req .ctx , providerRequestTimeout )
140
141
providers := bs .network .FindProvidersAsync (child , keys [0 ], maxProvidersPerRequest )
141
142
err := bs .sendWantlistToPeers (req .ctx , providers )
142
143
if err != nil {
143
144
log .Debugf ("error sending wantlist: %s" , err )
144
145
}
146
+ cancel ()
145
147
146
148
// Wait for wantNewBlocks to finish
147
149
<- done
You can’t perform that action at this time.
0 commit comments