From 344ada8b7c5e50be08d90d96fa8babfc1ae33e30 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 25 Oct 2021 21:37:25 +1100 Subject: [PATCH] Add disabled code for limiting wasted chunks --- peerconn.go | 1 + requesting.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/peerconn.go b/peerconn.go index 8e1f654d..c7a4e8cf 100644 --- a/peerconn.go +++ b/peerconn.go @@ -1335,6 +1335,7 @@ func (c *Peer) receiveChunk(msg *pp.Message) error { // Do we actually want this chunk? if t.haveChunk(ppReq) { + //panic(fmt.Sprintf("%+v", ppReq)) chunksReceived.Add("wasted", 1) c.allStats(add(1, func(cs *ConnStats) *Count { return &cs.ChunksReadWasted })) return nil diff --git a/requesting.go b/requesting.go index 669b0d2a..462d6818 100644 --- a/requesting.go +++ b/requesting.go @@ -215,6 +215,9 @@ func (p *Peer) getDesiredRequestState() (desired requestState) { allowedFast := p.peerAllowedFast.ContainsInt(pieceIndex) rsp.IterPendingChunks.Iter(func(ci request_strategy.ChunkIndex) { r := p.t.pieceRequestIndexOffset(pieceIndex) + ci + //if p.t.pendingRequests.Get(r) != 0 && !p.actualRequestState.Requests.Contains(r) { + // return + //} if !allowedFast { // We must signal interest to request this desired.Interested = true -- 2.48.1