]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Comments
authorMatt Joiner <anacrolix@gmail.com>
Mon, 10 May 2021 07:04:27 +0000 (17:04 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 7 Jun 2021 03:01:39 +0000 (13:01 +1000)
request-strategy.go

index 8f3811d4ae92d825b7a1ffca0200de102fc9f7dd..c373be7abe9416833594be4f37e4f478d7477b50 100644 (file)
@@ -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
-//}