@cryptotaxi247 / kubo / commits / a3356b041

fix minor data race in bitswap

Jeromy committed May 22, 2015 at 09:08 UTC a3356b04179769c3ca0813f6f1766ee36884e975
1 file changed +3 -1
exchange/bitswap/bitswap.go
+3 -1
@@ -287,8 +287,10 @@ func (bs *Bitswap) ReceiveMessage(ctx context.Context, p peer.ID, incoming bsmsg
287 if has, err := bs.blockstore.Has(block.Key()); err == nil && has {
288 bs.dupBlocksRecvd++
289 }
290 + brecvd := bs.blocksRecvd
291 + bdup := bs.dupBlocksRecvd
292 bs.counterLk.Unlock()
291 - log.Infof("got block %s from %s (%d,%d)", block, p, bs.blocksRecvd, bs.dupBlocksRecvd)
293 + log.Infof("got block %s from %s (%d,%d)", block, p, brecvd, bdup)
294
295 hasBlockCtx, cancel := context.WithTimeout(ctx, hasBlockTimeout)
296 if err := bs.HasBlock(hasBlockCtx, block); err != nil {