]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Code comments
authorMatt Joiner <anacrolix@gmail.com>
Tue, 5 Aug 2025 12:52:10 +0000 (22:52 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 5 Aug 2025 12:52:10 +0000 (22:52 +1000)
piece.go
request-strategy-impls.go
torrent-piece-request-order.go

index f1615b5f2a1660e21e86f0817959e20a5247d119..da548935ea79f726e6c46dd663b4b8cf7a9dd29e 100644 (file)
--- a/piece.go
+++ b/piece.go
@@ -335,6 +335,7 @@ func (p *Piece) UpdateCompletion() {
        p.t.updatePieceCompletion(p.index)
 }
 
+// TODO: Probably don't include Completion.Err?
 func (p *Piece) completion() (ret storage.Completion) {
        ret.Ok = p.storageCompletionOk
        if ret.Ok {
index 3db71c49e2d8e367d4f376cd788544dbf9db793e..e67bb9f0e3c0d12c7999074adc172d11846ae879 100644 (file)
@@ -32,7 +32,8 @@ func (r requestStrategyInputMultiTorrent) Capacity() (int64, bool) {
 
 // I don't think we need this for correctness purposes, but it must be faster to look up the Torrent
 // input because it's locked to a given Torrent. It would be easy enough to drop in the
-// multi-torrent version in this place and compare.
+// multi-torrent version in this place and compare. TODO: With unique.Handle on infohash, this would
+// not be necessary anymore. I don't think it's provided any performance benefit for some time now.
 type requestStrategyInputSingleTorrent struct {
        requestStrategyInputCommon
        t *Torrent
index 1e6cde0b50c5711e8156e25c3499427ac9222711..f50f6664b108f1afd8361ad149a9f8c99ca1f20e 100644 (file)
@@ -20,6 +20,7 @@ func (t *Torrent) updatePieceRequestOrderPiece(pieceIndex int) (changed bool) {
        if t.hasStorageCap() {
                return pro.pieces.Update(key, t.requestStrategyPieceOrderState(pieceIndex))
        }
+       // TODO: This might eject a piece that could count toward being unverified?
        pending := !t.ignorePieceForRequests(pieceIndex)
        if pending {
                newState := t.requestStrategyPieceOrderState(pieceIndex)