From d2f69877cfba09b00b870a118139ef898fa9b54a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 1 Mar 2009 17:37:10 +0000 Subject: [PATCH] (trunk libT) tweak r7978 --- libtransmission/torrent.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 06a037d64..2338491f6 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -2129,11 +2129,15 @@ tr_torrentCheckSeedRatio( tr_torrent * tor ) if( tr_torrentIsSeed( tor ) && tr_torrentGetSeedRatio( tor, &seedRatio ) ) { const double up = tor->uploadedCur + tor->uploadedPrev; - double down = tor->downloadedCur + tor->downloadedPrev; - if (!down) + uint64_t down = tor->downloadedCur + tor->downloadedPrev; + double ratio; + + /* maybe we're the initial seeder and never downloaded anything... */ + if( down == 0 ) down = tr_cpHaveValid( &tor->completion ); - - const double ratio = tr_getRatio( up, down ); + + ratio = tr_getRatio( up, down ); + if( ratio >= seedRatio ) { tr_torrentStop( tor );