From 4f3db19ca36cb264b9e2bd729a30f64c4cc585f3 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 29 Nov 2021 00:44:24 +1100 Subject: [PATCH] Optimize Torrent.haveAnyPieces --- torrent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torrent.go b/torrent.go index 79a3ecb6..d047be4e 100644 --- a/torrent.go +++ b/torrent.go @@ -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 {