From: Matt Joiner Date: Mon, 25 Oct 2021 10:37:25 +0000 (+1100) Subject: Add disabled code for limiting wasted chunks X-Git-Tag: v1.34.0^2~3 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=344ada8b7c5e50be08d90d96fa8babfc1ae33e30;p=btrtrc.git Add disabled code for limiting wasted chunks --- 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