]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Panic if request piece being marked
authorMatt Joiner <anacrolix@gmail.com>
Thu, 29 May 2025 08:42:47 +0000 (18:42 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 29 May 2025 08:42:47 +0000 (18:42 +1000)
peer.go

diff --git a/peer.go b/peer.go
index 988eb07bc79c486ad10525e7e929e84290f37f45..a7e94ae7669cca7e3797b9a754d0af9641a0f0f2 100644 (file)
--- a/peer.go
+++ b/peer.go
@@ -436,6 +436,10 @@ func (cn *Peer) shouldRequest(r RequestIndex) error {
        if cn.t.hashingPiece(pi) {
                panic("piece is being hashed")
        }
+       p := cn.t.piece(pi)
+       if p.marking {
+               panic("piece is being marked")
+       }
        if cn.t.pieceQueuedForHash(pi) {
                panic("piece is queued for hash")
        }