Record connection dirtied piece before queuing for hash

Not a bug, but probably more robust.
This commit is contained in:
Matt Joiner 2020-01-23 13:52:17 +11:00
parent dc643d2ed3
commit 4fae1f81df
1 changed files with 2 additions and 2 deletions

View File

@ -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))