Ignore:
Timestamp:
Nov 24, 2008, 4:21:23 AM (14 years ago)
Author:
charles
Message:

(libT) #1468: another stab at getting the peer transfer speeds both fast and a little more consistent.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r7069 r7147  
    3333
    3434#include "transmission.h"
     35#include "bandwidth.h"
    3536#include "bencode.h"
    3637#include "completion.h"
     
    497498    randomizeTiers( info );
    498499
    499     tor->rawSpeed[TR_CLIENT_TO_PEER] = tr_rcInit( );
    500     tor->rawSpeed[TR_PEER_TO_CLIENT] = tr_rcInit( );
    501     tor->pieceSpeed[TR_CLIENT_TO_PEER] = tr_rcInit( );
    502     tor->pieceSpeed[TR_PEER_TO_CLIENT] = tr_rcInit( );
     500    tor->bandwidth[TR_UP] = tr_bandwidthNew( h );
     501    tor->bandwidth[TR_DOWN] = tr_bandwidthNew( h );
    503502
    504503    tor->blockSize = getBlockSize( info->pieceSize );
     
    815814                            s->peersFrom );
    816815
    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] );
     816    s->rawUploadSpeed     = tr_bandwidthGetRawSpeed  ( tor->bandwidth[TR_UP] );
     817    s->rawDownloadSpeed   = tr_bandwidthGetRawSpeed  ( tor->bandwidth[TR_DOWN] );
     818    s->pieceUploadSpeed   = tr_bandwidthGetPieceSpeed( tor->bandwidth[TR_UP] );
     819    s->pieceDownloadSpeed = tr_bandwidthGetPieceSpeed( tor->bandwidth[TR_DOWN] );
    821820
    822821    usableSeeds += tor->info.webseedCount;
     
    11011100    h->torrentCount--;
    11021101
    1103     tr_rcClose( tor->pieceSpeed[TR_PEER_TO_CLIENT] );
    1104     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] );
     1102    tr_bandwidthFree( tor->bandwidth[TR_DOWN] );
     1103    tr_bandwidthFree( tor->bandwidth[TR_UP] );
    11071104
    11081105    tr_metainfoFree( inf );
Note: See TracChangeset for help on using the changeset viewer.