Ignore:
Timestamp:
Nov 23, 2008, 4:31:28 PM (14 years ago)
Author:
charles
Message:

(libT) #1468: speed display is very jumpy

File:
1 edited

Legend:

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

    r7133 r7137  
    3131#include "net.h"
    3232#include "peer-io.h"
    33 #include "ratecontrol.h"
    3433#include "trevent.h"
    3534#include "utils.h"
     
    7372struct tr_bandwidth
    7473{
    75     unsigned int    isUnlimited : 1;
    76     size_t          bytesUsed;
    77     size_t          bytesLeft;
     74    unsigned int  isUnlimited : 1;
     75    size_t        bytesLeft;
    7876};
    7977
     
    221219                struct tr_bandwidth * b = &io->bandwidth[TR_UP];
    222220                b->bytesLeft -= MIN( b->bytesLeft, n );
    223                 b->bytesUsed += n;
    224221            }
    225222
     
    257254        struct tr_bandwidth * b = io->bandwidth + TR_DOWN;
    258255        b->bytesLeft -= MIN( b->bytesLeft, (size_t)n );
    259         b->bytesUsed += n;
    260         dbgmsg( io, "%zu new input bytes. bytesUsed is %zu, bytesLeft is %zu", n, b->bytesUsed, b->bytesLeft );
     256        dbgmsg( io, "%zu new input bytes. bytesLeft is %zu", n, b->bytesLeft );
    261257
    262258        adjustInputBuffer( io );
     
    617613
    618614size_t
    619 tr_peerIoGetBandwidthUsed( const tr_peerIo * io,
    620                            tr_direction      direction )
    621 {
    622     assert( io );
    623     assert( direction == TR_UP || direction == TR_DOWN );
    624     return io->bandwidth[direction].bytesUsed;
    625 }
    626 
    627 size_t
    628615tr_peerIoGetWriteBufferSpace( const tr_peerIo * io )
    629616{
     
    650637
    651638void
    652 tr_peerIoSetBandwidth( tr_peerIo * io,
    653                        tr_direction direction,
    654                        size_t       bytesLeft )
     639tr_peerIoAllocateBandwidth( tr_peerIo     * io,
     640                            tr_direction    direction,
     641                            size_t          bytesLeft )
    655642{
    656643    struct tr_bandwidth * b;
     
    661648    b = io->bandwidth + direction;
    662649    b->isUnlimited = 0;
    663     b->bytesUsed = 0;
    664650    b->bytesLeft = bytesLeft;
    665651
     
    679665    b = io->bandwidth + direction;
    680666    b->isUnlimited = 1;
    681     b->bytesUsed = 0;
    682667    b->bytesLeft = 0;
    683668
     
    883868    return time( NULL ) - io->timeCreated;
    884869}
    885 
Note: See TracChangeset for help on using the changeset viewer.