From: Matt Joiner Date: Mon, 28 Jul 2025 02:16:19 +0000 (+1000) Subject: Update code comments X-Git-Tag: v1.59.0~2^2~90 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=96f0607f1334bca21de46e684dccf89741131062;p=btrtrc.git Update code comments --- diff --git a/piece.go b/piece.go index fc17714b..166da4d4 100644 --- a/piece.go +++ b/piece.go @@ -340,7 +340,6 @@ func (p *Piece) requestIndexMaxEnd() RequestIndex { return p.t.pieceRequestIndexBegin(p.index + 1) } -// TODO: Make this peer-only? func (p *Piece) availability() int { return len(p.t.connsWithAllPieces) + p.relativeAvailability } diff --git a/t.go b/t.go index 5b42a101..16fab38e 100644 --- a/t.go +++ b/t.go @@ -291,6 +291,7 @@ func (t *Torrent) PeerConns() []*PeerConn { return ret } +// TODO: Misleading method name. Webseed peers are not PeerConns. func (t *Torrent) WebseedPeerConns() []*Peer { t.cl.rLock() defer t.cl.rUnlock() diff --git a/torrent.go b/torrent.go index a69fa6bc..fc4f8cd7 100644 --- a/torrent.go +++ b/torrent.go @@ -247,7 +247,7 @@ func (t *Torrent) decPieceAvailability(i pieceIndex) { } func (t *Torrent) incPieceAvailability(i pieceIndex) { - // If we don't the info, this should be reconciled when we do. + // If we don't have the info, this should be reconciled when we do. if t.haveInfo() { p := t.piece(i) p.relativeAvailability++ @@ -3191,6 +3191,8 @@ func (t *Torrent) deleteConnWithAllPieces(p *Peer) bool { } func (t *Torrent) numActivePeers() int { + // TODO: Webseeds are "active" if they can serve any data. That means we need to track what + // pieces they're able to provide. return len(t.conns) + len(t.webSeeds) }