mirror of
https://github.com/transmission/transmission
synced 2025-02-22 22:20:39 +00:00
eta will now indicate time remaining to reach seed ratio when seeding
This commit is contained in:
parent
d08231d054
commit
fa3b9a12c5
2 changed files with 32 additions and 13 deletions
|
@ -801,6 +801,7 @@ tr_torrentStat( tr_torrent * tor )
|
|||
const tr_tracker_info * ti;
|
||||
int usableSeeds = 0;
|
||||
uint64_t now;
|
||||
double downloadedForRatio, seedRatio;
|
||||
|
||||
if( !tor )
|
||||
return NULL;
|
||||
|
@ -870,7 +871,6 @@ tr_torrentStat( tr_torrent * tor )
|
|||
s->haveValid = tr_cpHaveValid( &tor->completion );
|
||||
s->haveUnchecked = tr_cpHaveTotal( &tor->completion ) - s->haveValid;
|
||||
|
||||
|
||||
if( usableSeeds > 0 )
|
||||
{
|
||||
s->desiredAvailable = s->leftUntilDone;
|
||||
|
@ -891,17 +891,36 @@ tr_torrentStat( tr_torrent * tor )
|
|||
tr_bitfieldFree( peerPieces );
|
||||
}
|
||||
|
||||
if( s->leftUntilDone > s->desiredAvailable )
|
||||
s->eta = TR_ETA_NOT_AVAIL;
|
||||
else if( s->pieceDownloadSpeed < 0.1 )
|
||||
s->eta = TR_ETA_UNKNOWN;
|
||||
else
|
||||
s->eta = s->leftUntilDone / s->pieceDownloadSpeed / 1024.0;
|
||||
downloadedForRatio = s->downloadedEver ? s->downloadedEver : s->haveValid;
|
||||
s->ratio = tr_getRatio( s->uploadedEver, downloadedForRatio );
|
||||
|
||||
s->ratio = tr_getRatio(
|
||||
s->uploadedEver,
|
||||
s->downloadedEver ? s->downloadedEver : s->
|
||||
haveValid );
|
||||
switch( s->activity )
|
||||
{
|
||||
case TR_STATUS_DOWNLOAD:
|
||||
if( s->leftUntilDone > s->desiredAvailable )
|
||||
s->eta = TR_ETA_NOT_AVAIL;
|
||||
else if( s->pieceDownloadSpeed < 0.1 )
|
||||
s->eta = TR_ETA_UNKNOWN;
|
||||
else
|
||||
s->eta = s->leftUntilDone / s->pieceDownloadSpeed / 1024.0;
|
||||
break;
|
||||
|
||||
case TR_STATUS_SEED:
|
||||
if( tr_torrentGetSeedRatio( tor, &seedRatio ) )
|
||||
{
|
||||
if( s->pieceUploadSpeed < 0.1 )
|
||||
s->eta = TR_ETA_UNKNOWN;
|
||||
else
|
||||
s->eta = (downloadedForRatio * (seedRatio - s->ratio)) / s->pieceUploadSpeed / 1024.0;
|
||||
}
|
||||
else
|
||||
s->eta = TR_ETA_NOT_AVAIL;
|
||||
break;
|
||||
|
||||
default:
|
||||
s->eta = TR_ETA_NOT_AVAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
tr_torrentUnlock( tor );
|
||||
|
||||
|
|
|
@ -1331,8 +1331,8 @@ typedef struct tr_stat
|
|||
|
||||
#define TR_ETA_NOT_AVAIL -1
|
||||
#define TR_ETA_UNKNOWN -2
|
||||
/** Estimated number of seconds left until the torrent is done,
|
||||
or TR_ETA_NOT_AVAIL or TR_ETA_UNKNOWN */
|
||||
/** If downloading, estimated number of seconds left until the torrent is done.
|
||||
If seeding, estimated number of seconds left until seed ratio is reached. */
|
||||
int eta;
|
||||
|
||||
/** Number of peers that the tracker says this torrent has */
|
||||
|
|
Loading…
Reference in a new issue