1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-13 07:33:02 +00:00

Fix setting the ETA timestamps

Field etaDLSpeedCalculatedAt was set too early, causing the condition
following it to always be false. The same for etaULSpeedCalculatedAt.
This commit is contained in:
geertjan 2018-02-19 21:06:34 +01:00
parent 96926a8337
commit 23e469a6b2

View file

@ -1429,10 +1429,10 @@ tr_stat const* tr_torrentStat(tr_torrent* tor)
case TR_STATUS_DOWNLOAD: case TR_STATUS_DOWNLOAD:
if (tor->etaDLSpeedCalculatedAt + 800 < now) if (tor->etaDLSpeedCalculatedAt + 800 < now)
{ {
tor->etaDLSpeedCalculatedAt = now;
tor->etaDLSpeed_Bps = tor->etaDLSpeedCalculatedAt + 4000 < now ? tor->etaDLSpeed_Bps = tor->etaDLSpeedCalculatedAt + 4000 < now ?
pieceDownloadSpeed_Bps : /* if no recent previous speed, no need to smooth */ pieceDownloadSpeed_Bps : /* if no recent previous speed, no need to smooth */
(tor->etaDLSpeed_Bps * 4.0 + pieceDownloadSpeed_Bps) / 5.0; /* smooth across 5 readings */ (tor->etaDLSpeed_Bps * 4.0 + pieceDownloadSpeed_Bps) / 5.0; /* smooth across 5 readings */
tor->etaDLSpeedCalculatedAt = now;
} }
if (s->leftUntilDone > s->desiredAvailable && tor->info.webseedCount < 1) if (s->leftUntilDone > s->desiredAvailable && tor->info.webseedCount < 1)
@ -1460,10 +1460,10 @@ tr_stat const* tr_torrentStat(tr_torrent* tor)
{ {
if (tor->etaULSpeedCalculatedAt + 800 < now) if (tor->etaULSpeedCalculatedAt + 800 < now)
{ {
tor->etaULSpeedCalculatedAt = now;
tor->etaULSpeed_Bps = tor->etaULSpeedCalculatedAt + 4000 < now ? tor->etaULSpeed_Bps = tor->etaULSpeedCalculatedAt + 4000 < now ?
pieceUploadSpeed_Bps : /* if no recent previous speed, no need to smooth */ pieceUploadSpeed_Bps : /* if no recent previous speed, no need to smooth */
(tor->etaULSpeed_Bps * 4.0 + pieceUploadSpeed_Bps) / 5.0; /* smooth across 5 readings */ (tor->etaULSpeed_Bps * 4.0 + pieceUploadSpeed_Bps) / 5.0; /* smooth across 5 readings */
tor->etaULSpeedCalculatedAt = now;
} }
if (tor->etaULSpeed_Bps == 0) if (tor->etaULSpeed_Bps == 0)