peerconn.go | 3 +++ diff --git a/peerconn.go b/peerconn.go index 098d93fc46a6ba8f59833eaa9dfbce07200ae6e9..4ec0944ba7090f3a9ede320a3873488e0610728e 100644 --- a/peerconn.go +++ b/peerconn.go @@ -570,6 +570,9 @@ // This function seems to only used by Peer.request. It's all logic checks, so maybe we can no-op it // when we want to go fast. func (cn *Peer) shouldRequest(r RequestIndex) error { pi := pieceIndex(r / cn.t.chunksPerRegularPiece()) + if cn.requestState.Cancelled.Contains(r) { + return errors.New("request is cancelled and waiting acknowledgement") + } if !cn.peerHasPiece(pi) { return errors.New("requesting piece peer doesn't have") }