@cryptotaxi247 / kubo / commits / aa55eebe7

fixed two more

Henry committed Mar 7, 2015 at 11:47 UTC aa55eebe7ee207457a7a262db51335821b0d936e
1 file changed +4 -2
exchange/bitswap/workers.go
+4 -2
@@ -68,11 +68,12 @@ func (bs *Bitswap) provideWorker(ctx context.Context) {
68 log.Debug("provideKeys channel closed")
69 return
70 }
71 - ctx, _ := context.WithTimeout(ctx, provideTimeout)
71 + ctx, cancel := context.WithTimeout(ctx, provideTimeout)
72 err := bs.network.Provide(ctx, k)
73 if err != nil {
74 log.Error(err)
75 }
76 + cancel()
77 case <-ctx.Done():
78 return
79 }
@@ -136,12 +137,13 @@ func (bs *Bitswap) clientWorker(parent context.Context) {
137 // NB: Optimization. Assumes that providers of key[0] are likely to
138 // be able to provide for all keys. This currently holds true in most
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)
141 providers := bs.network.FindProvidersAsync(child, keys[0], maxProvidersPerRequest)
142 err := bs.sendWantlistToPeers(req.ctx, providers)
143 if err != nil {
144 log.Debugf("error sending wantlist: %s", err)
145 }
146 + cancel()
147
148 // Wait for wantNewBlocks to finish
149 <-done