mirror of
https://github.com/transmission/transmission
synced 2024-12-24 16:52:39 +00:00
#843: download eta should consider availability
This commit is contained in:
parent
e51b2e8267
commit
9f3f0c03e6
4 changed files with 29 additions and 8 deletions
|
@ -83,7 +83,9 @@ getProgressString( const tr_info * info, const tr_stat * torStat )
|
|||
const int eta = torStat->eta;
|
||||
GString * gstr = g_string_new( str );
|
||||
g_string_append( gstr, " - " );
|
||||
if( eta < 0 )
|
||||
if( eta == TR_ETA_NOT_AVAIL )
|
||||
g_string_append( gstr, _( "Not available" ) );
|
||||
else if( eta == TR_ETA_UNKNOWN )
|
||||
g_string_append( gstr, _( "Stalled" ) );
|
||||
else {
|
||||
char timestr[128];
|
||||
|
|
|
@ -283,8 +283,11 @@ tr_torrent_status_str ( TrTorrent * gtor )
|
|||
break;
|
||||
|
||||
case TR_STATUS_DOWNLOAD:
|
||||
if( eta < 0 )
|
||||
top = g_strdup_printf( _("Stalled (%.1f%%)"), prog );
|
||||
|
||||
if( eta == TR_ETA_NOT_AVAIL )
|
||||
top = g_strdup_printf( _("Not available (%.1f%%)" ), prog );
|
||||
else if( eta == TR_ETA_UNKNOWN )
|
||||
top = g_strdup_printf( _( "Stalled (%.1f%%)" ), prog );
|
||||
else {
|
||||
char timestr[128];
|
||||
tr_strltime( timestr, eta, sizeof( timestr ) );
|
||||
|
|
|
@ -626,10 +626,6 @@ tr_torrentStat( tr_torrent * tor )
|
|||
s->startDate = tor->startDate;
|
||||
s->activityDate = tor->activityDate;
|
||||
|
||||
s->eta = s->rateDownload < 0.1
|
||||
? -1.0f
|
||||
: (s->leftUntilDone / s->rateDownload / 1024.0);
|
||||
|
||||
s->corruptEver = tor->corruptCur + tor->corruptPrev;
|
||||
s->downloadedEver = tor->downloadedCur + tor->downloadedPrev;
|
||||
s->uploadedEver = tor->uploadedCur + tor->uploadedPrev;
|
||||
|
@ -660,6 +656,13 @@ tr_torrentStat( tr_torrent * tor )
|
|||
tr_bitfieldFree( availablePieces );
|
||||
}
|
||||
|
||||
if( s->desiredAvailable != s->leftUntilDone )
|
||||
s->eta = TR_ETA_NOT_AVAIL;
|
||||
else if( s->rateDownload < 0.1 )
|
||||
s->eta = TR_ETA_UNKNOWN;
|
||||
else
|
||||
s->eta = s->leftUntilDone / (s->rateDownload / 1024.0);
|
||||
|
||||
s->ratio = tr_getRatio( s->uploadedEver,
|
||||
s->downloadedEver ? s->downloadedEver : s->haveValid );
|
||||
|
||||
|
|
|
@ -840,13 +840,26 @@ struct tr_stat
|
|||
tr_errno error;
|
||||
char errorString[128];
|
||||
|
||||
/* [0..1] */
|
||||
float recheckProgress;
|
||||
|
||||
/* [0..1] */
|
||||
float percentComplete;
|
||||
|
||||
/* [0..1] */
|
||||
float percentDone;
|
||||
|
||||
/* KiB/s */
|
||||
float rateDownload;
|
||||
|
||||
/* KiB/s */
|
||||
float rateUpload;
|
||||
|
||||
int eta;
|
||||
#define TR_ETA_NOT_AVAIL -1
|
||||
#define TR_ETA_UNKNOWN -2
|
||||
/* seconds */
|
||||
int eta;
|
||||
|
||||
int peersKnown;
|
||||
int peersConnected;
|
||||
int peersFrom[TR_PEER_FROM__MAX];
|
||||
|
|
Loading…
Reference in a new issue