From d90c41c53481d37c1dfcc4a9da4ba48b5cd4a53d Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sat, 18 Sep 2021 19:00:21 +1000 Subject: [PATCH] Add choking/allowed fast checks to Peer.shouldRequest --- peerconn.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/peerconn.go b/peerconn.go index 4aee30fd..2174b0f6 100644 --- a/peerconn.go +++ b/peerconn.go @@ -563,6 +563,9 @@ func (cn *Peer) shouldRequest(r Request) error { if cn.t.pieceQueuedForHash(pieceIndex(r.Index)) { panic("piece is queued for hash") } + if cn.peerChoking && !cn.peerAllowedFast.Contains(bitmap.BitIndex(r.Index)) { + panic("peer choking and piece not allowed fast") + } return nil } -- 2.48.1