Changeset 11718


Ignore:
Timestamp:
Jan 20, 2011, 12:31:46 AM (12 years ago)
Author:
jordan
Message:

(trunk libT) #3921 "no overhead for reads" -- fixed. thanks to jch for reporting this.

File:
1 edited

Legend:

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

    r11709 r11718  
    147147            const size_t oldLen = evbuffer_get_length( io->inbuf );
    148148            const int ret = io->canRead( io, io->userData, &piece );
    149 
    150149            const size_t used = oldLen - evbuffer_get_length( io->inbuf );
     150            const unsigned int overhead = guessPacketOverhead( used );
     151            const uint64_t now = tr_time_msec( );
    151152
    152153            assert( tr_isPeerIo( io ) );
     
    154155            if( piece || (piece!=used) )
    155156            {
    156                 const uint64_t now = tr_time_msec( );
    157 
    158157                if( piece )
    159158                    tr_bandwidthUsed( &io->bandwidth, TR_DOWN, piece, TRUE, now );
     
    162161                    tr_bandwidthUsed( &io->bandwidth, TR_DOWN, used - piece, FALSE, now );
    163162            }
     163
     164            if( overhead > 0 )
     165                tr_bandwidthUsed( &io->bandwidth, TR_UP, overhead, FALSE, now );
    164166
    165167            switch( ret )
Note: See TracChangeset for help on using the changeset viewer.