panic("requesting while choked and not allowed fast")
}
}
+ if cn.t.hashingPiece(pieceIndex(r.Index)) {
+ panic("piece is being hashed")
+ }
+ if cn.t.pieceQueuedForHash(pieceIndex(r.Index)) {
+ panic("piece is queued for hash")
+ }
if cn.requests == nil {
cn.requests = make(map[request]struct{})
}
f(&t.stats)
f(&t.cl.stats)
}
+
+func (t *Torrent) hashingPiece(i pieceIndex) bool {
+ return t.pieces[i].hashing
+}
+
+func (t *Torrent) pieceQueuedForHash(i pieceIndex) bool {
+ return t.piecesQueuedForHash.Get(bitmap.BitIndex(i))
+}