Changeset 6991


Ignore:
Timestamp:
Oct 30, 2008, 3:41:45 AM (12 years ago)
Author:
charles
Message:

(libT) fix unlimited-upload-speed bug reported by Gimp_ and Lacrocivious

Location:
trunk/libtransmission
Files:
2 edited

Legend:

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

    r6961 r6991  
    588588
    589589size_t
    590 tr_peerIoGetBandwidthLeft( const tr_peerIo * io,
    591                            tr_direction      direction )
    592 {
    593     assert( io );
    594     assert( direction == TR_UP || direction == TR_DOWN );
    595     return io->bandwidth[direction].bytesLeft;
    596 }
    597 
    598 size_t
    599590tr_peerIoGetWriteBufferSpace( const tr_peerIo * io )
    600591{
    601592    const size_t desiredBufferLen = 4096;
    602     const size_t currentLiveLen =
    603         EVBUFFER_LENGTH( EVBUFFER_OUTPUT( io->bufev ) );
    604 
    605     const size_t desiredLiveLen = tr_peerIoGetBandwidthLeft( io, TR_UP );
     593    const size_t currentLiveLen = EVBUFFER_LENGTH( EVBUFFER_OUTPUT( io->bufev ) );
     594
    606595    const size_t currentLbufLen = EVBUFFER_LENGTH( io->output );
    607 
     596    const size_t desiredLiveLen = io->bandwidth[TR_UP].isUnlimited
     597                                ? INT_MAX
     598                                : io->bandwidth[TR_UP].bytesLeft;
     599
     600    const size_t currentLen = currentLiveLen + currentLbufLen;
    608601    const size_t desiredLen = desiredBufferLen + desiredLiveLen;
    609     const size_t currentLen = currentLiveLen + currentLbufLen;
    610602
    611603    size_t       freeSpace = 0;
  • trunk/libtransmission/peer-io.h

    r6949 r6991  
    199199                                             tr_direction      direction );
    200200
    201 size_t            tr_peerIoGetBandwidthLeft( const tr_peerIo * io,
    202                                              tr_direction      direction );
    203 
    204201size_t            tr_peerIoGetWriteBufferSpace( const tr_peerIo * io );
    205202
Note: See TracChangeset for help on using the changeset viewer.