From: Matt Joiner Date: Thu, 23 Jan 2020 02:52:17 +0000 (+1100) Subject: Record connection dirtied piece before queuing for hash X-Git-Tag: v1.12.0~4 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=4fae1f81df36b8f5b5e5ff14e160b93ec6d5d6a4;p=btrtrc.git Record connection dirtied piece before queuing for hash Not a bug, but probably more robust. --- diff --git a/connection.go b/connection.go index 3a857d91..76c15d32 100644 --- a/connection.go +++ b/connection.go @@ -1400,13 +1400,13 @@ func (c *connection) receiveChunk(msg *pp.Message) error { return nil } + c.onDirtiedPiece(pieceIndex(req.Index)) + if t.pieceAllDirty(pieceIndex(req.Index)) { t.queuePieceCheck(pieceIndex(req.Index)) t.pendAllChunkSpecs(pieceIndex(req.Index)) } - c.onDirtiedPiece(pieceIndex(req.Index)) - cl.event.Broadcast() // We do this because we've written a chunk, and may change PieceState.Partial. t.publishPieceChange(pieceIndex(req.Index))