Skip to content

Commit fdf4423

Browse files
committedJul 14, 2015
fix race introduced in bitswap
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
1 parent 498e927 commit fdf4423

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎exchange/bitswap/bitswap.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,14 @@ func (bs *Bitswap) HasBlock(ctx context.Context, blk *blocks.Block) error {
228228
default:
229229
}
230230

231-
bs.notifications.Publish(blk)
232-
233231
err := bs.tryPutBlock(blk, 4) // attempt to store block up to four times
234232
if err != nil {
235233
log.Errorf("Error writing block to datastore: %s", err)
236234
return err
237235
}
238236

237+
bs.notifications.Publish(blk)
238+
239239
select {
240240
case bs.newBlocks <- blk:
241241
// send block off to be reprovided

0 commit comments

Comments
 (0)
Please sign in to comment.