report a speed of 0 when no peers are connected.

This commit is contained in:
Charles Kerr 2007-10-13 23:57:13 +00:00
parent ac98f63060
commit 38d6b03a8e
1 changed files with 10 additions and 8 deletions

View File

@ -722,14 +722,16 @@ tr_torrentStat( tr_torrent * tor )
s->cpStatus = tor->cpStatus; s->cpStatus = tor->cpStatus;
/* tr_rcRate() doesn't make the difference between 'piece' /* rcRate's averaging code can make it appear that we're
messages and other messages, which causes a non-zero * still sending bytes after a torrent stops or all the
download rate even tough we are not downloading. So we * peers disconnect, so short-circuit that appearance here */
force it to zero not to confuse the user. */ if( tor->isRunning && s->peersConnected ) {
s->rateDownload = tor->isRunning s->rateDownload = tr_rcRate( tor->download );
? tr_rcRate( tor->download ) s->rateUpload = tr_rcRate( tor->upload );
: 0.0; } else {
s->rateUpload = tr_rcRate( tor->upload ); s->rateDownload = 0.0;
s->rateUpload = 0.0;
}
tr_trackerGetCounts( tc, tr_trackerGetCounts( tc,
&s->completedFromTracker, &s->completedFromTracker,