From: Matt Joiner Date: Tue, 5 Aug 2025 12:52:10 +0000 (+1000) Subject: Code comments X-Git-Tag: v1.59.0~2^2~47 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=358296ac91e8ec540213d294fd8800723bc7f692;p=btrtrc.git Code comments --- diff --git a/piece.go b/piece.go index f1615b5f..da548935 100644 --- 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 { diff --git a/request-strategy-impls.go b/request-strategy-impls.go index 3db71c49..e67bb9f0 100644 --- a/request-strategy-impls.go +++ b/request-strategy-impls.go @@ -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 diff --git a/torrent-piece-request-order.go b/torrent-piece-request-order.go index 1e6cde0b..f50f6664 100644 --- a/torrent-piece-request-order.go +++ b/torrent-piece-request-order.go @@ -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)