type PieceState struct {
Priority piecePriority
storage.Completion
- // The piece is being hashed, or is queued for hash.
+ // The piece is being hashed, or is queued for hash. Deprecated: Use those fields instead.
Checking bool
+
+ Hashing bool
+ QueuedForHash bool
+ // The piece state is being marked in the storage.
+ Marking bool
+
// Some of the piece has been obtained.
Partial bool
}
p := &t.pieces[index]
ret.Priority = t.piecePriority(index)
ret.Completion = p.completion()
- if p.queuedForHash() || p.hashing {
- ret.Checking = true
- }
+ ret.QueuedForHash = p.queuedForHash()
+ ret.Hashing = p.hashing
+ ret.Checking = ret.QueuedForHash || ret.Hashing
+ ret.Marking = p.marking
if !ret.Complete && t.piecePartiallyDownloaded(index) {
ret.Partial = true
}
return ""
}
}()
- if psr.Checking {
+ if psr.Hashing {
ret += "H"
}
+ if psr.QueuedForHash {
+ ret += "Q"
+ }
+ if psr.Marking {
+ ret += "M"
+ }
if psr.Partial {
ret += "P"
}
}
}
+ p.marking = true
+ t.publishPieceChange(piece)
+ defer func() {
+ p.marking = false
+ t.publishPieceChange(piece)
+ }()
+
if passed {
if len(p.dirtiers) != 0 {
// Don't increment stats above connection-level for every involved connection.