Changeset 7137 for trunk/libtransmission/peer-io.c
- Timestamp:
- Nov 23, 2008, 4:31:28 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-io.c
r7133 r7137 31 31 #include "net.h" 32 32 #include "peer-io.h" 33 #include "ratecontrol.h"34 33 #include "trevent.h" 35 34 #include "utils.h" … … 73 72 struct tr_bandwidth 74 73 { 75 unsigned int isUnlimited : 1; 76 size_t bytesUsed; 77 size_t bytesLeft; 74 unsigned int isUnlimited : 1; 75 size_t bytesLeft; 78 76 }; 79 77 … … 221 219 struct tr_bandwidth * b = &io->bandwidth[TR_UP]; 222 220 b->bytesLeft -= MIN( b->bytesLeft, n ); 223 b->bytesUsed += n;224 221 } 225 222 … … 257 254 struct tr_bandwidth * b = io->bandwidth + TR_DOWN; 258 255 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 ); 261 257 262 258 adjustInputBuffer( io ); … … 617 613 618 614 size_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_t628 615 tr_peerIoGetWriteBufferSpace( const tr_peerIo * io ) 629 616 { … … 650 637 651 638 void 652 tr_peerIo SetBandwidth( tr_peerIo *io,653 tr_directiondirection,654 size_tbytesLeft )639 tr_peerIoAllocateBandwidth( tr_peerIo * io, 640 tr_direction direction, 641 size_t bytesLeft ) 655 642 { 656 643 struct tr_bandwidth * b; … … 661 648 b = io->bandwidth + direction; 662 649 b->isUnlimited = 0; 663 b->bytesUsed = 0;664 650 b->bytesLeft = bytesLeft; 665 651 … … 679 665 b = io->bandwidth + direction; 680 666 b->isUnlimited = 1; 681 b->bytesUsed = 0;682 667 b->bytesLeft = 0; 683 668 … … 883 868 return time( NULL ) - io->timeCreated; 884 869 } 885
Note: See TracChangeset
for help on using the changeset viewer.