Ignore:
Timestamp:
Nov 8, 2008, 2:49:04 AM (14 years ago)
Author:
charles
Message:

more fucking around with the speed measurements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r7065 r7069  
    497497    randomizeTiers( info );
    498498
     499    tor->rawSpeed[TR_CLIENT_TO_PEER] = tr_rcInit( );
     500    tor->rawSpeed[TR_PEER_TO_CLIENT] = tr_rcInit( );
    499501    tor->pieceSpeed[TR_CLIENT_TO_PEER] = tr_rcInit( );
    500502    tor->pieceSpeed[TR_PEER_TO_CLIENT] = tr_rcInit( );
     
    745747{
    746748    return tor ? &tor->info : NULL;
    747 }
    748 
    749 static double
    750 tr_torrentGetRate( const tr_torrent * tor,
    751                    tr_direction       direction )
    752 {
    753     assert( tor != NULL );
    754     assert( direction == TR_UP || direction == TR_DOWN );
    755 
    756     return tr_rcRate( tor->pieceSpeed[direction] );
    757749}
    758750
     
    823815                            s->peersFrom );
    824816
    825     s->rateDownload = tr_torrentGetRate( tor, TR_PEER_TO_CLIENT );
    826 
    827     s->rateUpload = tr_torrentGetRate( tor, TR_CLIENT_TO_PEER );
     817    s->rawUploadSpeed     = tr_rcRate( tor->rawSpeed[TR_UP] );
     818    s->rawDownloadSpeed   = tr_rcRate( tor->rawSpeed[TR_DOWN] );
     819    s->pieceUploadSpeed   = tr_rcRate( tor->pieceSpeed[TR_UP] );
     820    s->pieceDownloadSpeed = tr_rcRate( tor->pieceSpeed[TR_DOWN] );
    828821
    829822    usableSeeds += tor->info.webseedCount;
     
    881874    if( s->leftUntilDone > s->desiredAvailable )
    882875        s->eta = TR_ETA_NOT_AVAIL;
    883     else if( s->rateDownload < 0.1 )
     876    else if( s->pieceDownloadSpeed < 0.1 )
    884877        s->eta = TR_ETA_UNKNOWN;
    885878    else
    886         s->eta = s->leftUntilDone / s->rateDownload / 1024.0;
     879        s->eta = s->leftUntilDone / s->pieceDownloadSpeed / 1024.0;
    887880
    888881    s->ratio = tr_getRatio(
     
    11101103    tr_rcClose( tor->pieceSpeed[TR_PEER_TO_CLIENT] );
    11111104    tr_rcClose( tor->pieceSpeed[TR_CLIENT_TO_PEER] );
     1105    tr_rcClose( tor->rawSpeed[TR_PEER_TO_CLIENT] );
     1106    tr_rcClose( tor->rawSpeed[TR_CLIENT_TO_PEER] );
    11121107
    11131108    tr_metainfoFree( inf );
Note: See TracChangeset for help on using the changeset viewer.