From 16e3803082819a1cdb7bee83f41b23fc3d36b3f0 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 17 Jun 2008 14:25:23 +0000 Subject: [PATCH] small tr_torrentStat() speedup suggested by BentMyWookie --- libtransmission/torrent.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 69b7ff057..7bd2b8f11 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -733,8 +733,9 @@ tr_torrentStat( tr_torrent * tor ) s->leftUntilDone = tr_cpLeftUntilDone( tor->completion ); s->sizeWhenDone = tr_cpSizeWhenDone( tor->completion ); - s->recheckProgress = - 1.0 - (tr_torrentCountUncheckedPieces( tor ) / (double) tor->info.pieceCount); + s->recheckProgress = s->status == TR_STATUS_CHECK + ? 1.0 - (tr_torrentCountUncheckedPieces( tor ) / (double) tor->info.pieceCount) + : 0.0; tr_torrentGetRates( tor, &s->rateDownload, &s->rateUpload );