]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Update code comments
authorMatt Joiner <anacrolix@gmail.com>
Mon, 28 Jul 2025 02:16:19 +0000 (12:16 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 28 Jul 2025 02:16:19 +0000 (12:16 +1000)
piece.go
t.go
torrent.go

index fc17714b1b05c5a9e7e606ed6b32a8807d4eba48..166da4d4cd2898f6ad1f101c378f370cfb2c6327 100644 (file)
--- 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 5b42a10170ed1b41e59ce71fa88f796128ec8901..16fab38e35a0a0d51369258b75562236a60a62b1 100644 (file)
--- 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()
index a69fa6bca6791b954b4ab1cb7a40aaee31cc9bff..fc4f8cd7fba72338e8496e66b25f18a14b5f3dca 100644 (file)
@@ -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)
 }