From d9172ef2778b7a1405a8e360c8b1beda829dc774 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 10 May 2021 17:04:27 +1000 Subject: [PATCH] Comments --- request-strategy.go | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/request-strategy.go b/request-strategy.go index 8f3811d4..c373be7a 100644 --- a/request-strategy.go +++ b/request-strategy.go @@ -165,6 +165,7 @@ func (cl *Client) doRequests() { }) // Move requestees for this piece to the back. lastIndex := len(peers) - 1 + // Probably should sort the contributees, to make the ordering more deterministic. for peerIndex := range contributed { peers[peerIndex], peers[lastIndex] = peers[lastIndex], peers[peerIndex] delete(contributed, peerIndex) @@ -179,33 +180,3 @@ func (cl *Client) doRequests() { }) } } - -//func (requestStrategyDefaults) iterUndirtiedChunks(p requestStrategyPiece, f func(ChunkSpec) bool) bool { -// chunkIndices := p.dirtyChunks().Copy() -// chunkIndices.FlipRange(0, bitmap.BitIndex(p.numChunks())) -// return iter.ForPerm(chunkIndices.Len(), func(i int) bool { -// ci, err := chunkIndices.RB.Select(uint32(i)) -// if err != nil { -// panic(err) -// } -// return f(p.chunkIndexRequest(pp.Integer(ci)).ChunkSpec) -// }) -//} - -// -//func iterUnbiasedPieceRequestOrder( -// cn requestStrategyConnection, -// f func(piece pieceIndex) bool, -// pieceRequestOrder []pieceIndex, -//) bool { -// cn.torrent().sortPieceRequestOrder(pieceRequestOrder) -// for _, i := range pieceRequestOrder { -// if !cn.peerHasPiece(i) || cn.torrent().ignorePieceForRequests(i) { -// continue -// } -// if !f(i) { -// return false -// } -// } -// return true -//} -- 2.48.1