Changeset 3407


Ignore:
Timestamp:
Oct 13, 2007, 11:57:13 PM (15 years ago)
Author:
charles
Message:

report a speed of 0 when no peers are connected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r3398 r3407  
    723723    s->cpStatus = tor->cpStatus;
    724724
    725     /* tr_rcRate() doesn't make the difference between 'piece'
    726        messages and other messages, which causes a non-zero
    727        download rate even tough we are not downloading. So we
    728        force it to zero not to confuse the user. */
    729     s->rateDownload = tor->isRunning
    730         ? tr_rcRate( tor->download )
    731         : 0.0;
    732     s->rateUpload = tr_rcRate( tor->upload );
     725    /* rcRate's averaging code can make it appear that we're
     726     * still sending bytes after a torrent stops or all the
     727     * peers disconnect, so short-circuit that appearance here */
     728    if( tor->isRunning && s->peersConnected ) {
     729        s->rateDownload = tr_rcRate( tor->download );
     730        s->rateUpload = tr_rcRate( tor->upload );
     731    } else {
     732        s->rateDownload = 0.0;
     733        s->rateUpload = 0.0;
     734    }
    733735   
    734736    tr_trackerGetCounts( tc,
Note: See TracChangeset for help on using the changeset viewer.