Changeset 8550


Ignore:
Timestamp:
May 28, 2009, 2:28:14 AM (12 years ago)
Author:
charles
Message:

(trunk libT) #2022: Torrentbar shows wrong speeds: Webseed-peers aren't taken into account

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r8433 r8550  
    17881788}
    17891789
     1790float
     1791tr_peerMgrGetWebseedSpeed( const tr_torrent * tor, uint64_t now )
     1792{
     1793    int i;
     1794    float tmp;
     1795    float ret = 0;
     1796
     1797    const Torrent * t = tor->torrentPeers;
     1798    const int n = tr_ptrArraySize( &t->webseeds );
     1799    const tr_webseed ** webseeds = (const tr_webseed**) tr_ptrArrayBase( &t->webseeds );
     1800
     1801    for( i=0; i<n; ++i )
     1802        if( tr_webseedGetSpeed( webseeds[i], now, &tmp ) )
     1803            ret += tmp;
     1804
     1805    return ret;
     1806}
     1807
     1808
    17901809float*
    17911810tr_peerMgrWebSpeeds( const tr_torrent * tor )
  • trunk/libtransmission/peer-mgr.h

    r8415 r8550  
    174174                                          int              * setmeCount );
    175175
     176float tr_peerMgrGetWebseedSpeed( const tr_torrent * tor, uint64_t now );
     177
    176178float* tr_peerMgrWebSpeeds( const tr_torrent * tor );
    177179
  • trunk/libtransmission/torrent.c

    r8469 r8550  
    844844    uint64_t                now;
    845845    double                  downloadedForRatio, seedRatio=0;
     846    double                  d;
    846847    tr_bool                 checkSeedRatio;
    847848
     
    882883
    883884    now = tr_date( );
     885    d = tr_peerMgrGetWebseedSpeed( tor, now );
    884886    s->swarmSpeed         = tr_rcRate( &tor->swarmSpeed, now );
    885887    s->rawUploadSpeed     = tr_bandwidthGetRawSpeed  ( tor->bandwidth, now, TR_UP );
    886     s->rawDownloadSpeed   = tr_bandwidthGetRawSpeed  ( tor->bandwidth, now, TR_DOWN );
    887888    s->pieceUploadSpeed   = tr_bandwidthGetPieceSpeed( tor->bandwidth, now, TR_UP );
    888     s->pieceDownloadSpeed = tr_bandwidthGetPieceSpeed( tor->bandwidth, now, TR_DOWN );
     889    s->rawDownloadSpeed   = d + tr_bandwidthGetRawSpeed  ( tor->bandwidth, now, TR_DOWN );
     890    s->pieceDownloadSpeed = d + tr_bandwidthGetPieceSpeed( tor->bandwidth, now, TR_DOWN );
    889891
    890892    usableSeeds += tor->info.webseedCount;
Note: See TracChangeset for help on using the changeset viewer.