(trunk libT) tweak r7978

This commit is contained in:
Charles Kerr 2009-03-01 17:37:10 +00:00
parent c5ff01072c
commit d2f69877cf
1 changed files with 8 additions and 4 deletions

View File

@ -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 );