]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Optimize Torrent.haveAnyPieces
authorMatt Joiner <anacrolix@gmail.com>
Sun, 28 Nov 2021 13:44:24 +0000 (00:44 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 28 Nov 2021 13:44:24 +0000 (00:44 +1100)
torrent.go

index 79a3ecb65ddd7a3064ad5b244eb5f72d48da5a86..d047be4ed44c1a925699ac6f61e3a3dec7e623fe 100644 (file)
@@ -908,7 +908,7 @@ func (t *Torrent) hashPiece(piece pieceIndex) (ret metainfo.Hash, err error) {
 }
 
 func (t *Torrent) haveAnyPieces() bool {
-       return t._completedPieces.GetCardinality() != 0
+       return !t._completedPieces.IsEmpty()
 }
 
 func (t *Torrent) haveAllPieces() bool {