1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 02:30:39 +08:00

fix race introduced in bitswap

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2015-07-14 11:11:16 -07:00
parent 498e927ac7
commit fdf4423c8b

View File

@ -228,14 +228,14 @@ func (bs *Bitswap) HasBlock(ctx context.Context, blk *blocks.Block) error {
default:
}
bs.notifications.Publish(blk)
err := bs.tryPutBlock(blk, 4) // attempt to store block up to four times
if err != nil {
log.Errorf("Error writing block to datastore: %s", err)
return err
}
bs.notifications.Publish(blk)
select {
case bs.newBlocks <- blk:
// send block off to be reprovided