Changeset 5176


Ignore:
Timestamp:
Feb 29, 2008, 5:09:33 PM (14 years ago)
Author:
charles
Message:

#727: Download speed setting also affects upload speed, peer informations in torrent inspector

File:
1 edited

Legend:

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

    r5172 r5176  
    15721572{
    15731573    ReadState ret;
    1574     tr_peermsgs * msgs = (tr_peermsgs *) vmsgs;
    1575     struct evbuffer * inbuf = EVBUFFER_INPUT ( evin );
    1576     const size_t buflen = EVBUFFER_LENGTH( inbuf );
    1577     const size_t downloadMax = getDownloadMax( msgs );
    1578     const size_t n = MIN( buflen, downloadMax );
    1579 
    1580     if( !n )
     1574    tr_peermsgs * msgs = vmsgs;
     1575    struct evbuffer * in = EVBUFFER_INPUT ( evin );
     1576    const size_t inlen = EVBUFFER_LENGTH( in );
     1577
     1578    if( !inlen )
    15811579    {
    15821580        ret = READ_DONE;
    15831581    }
     1582    else if( msgs->state == AWAITING_BT_PIECE )
     1583    {
     1584        const size_t downloadMax = getDownloadMax( msgs );
     1585        const size_t n = MIN( inlen, downloadMax );
     1586        ret = n ? readBtPiece( msgs, in, n ) : READ_DONE;
     1587    }
    15841588    else switch( msgs->state )
    15851589    {
    1586         case AWAITING_BT_LENGTH:  ret = readBtLength ( msgs, inbuf, n ); break;
    1587         case AWAITING_BT_ID:      ret = readBtId     ( msgs, inbuf, n ); break;
    1588         case AWAITING_BT_MESSAGE: ret = readBtMessage( msgs, inbuf, n ); break;
    1589         case AWAITING_BT_PIECE:   ret = readBtPiece  ( msgs, inbuf, n ); break;
    1590         default: assert( 0 );
     1590        case AWAITING_BT_LENGTH:  ret = readBtLength ( msgs, in, inlen ); break;
     1591        case AWAITING_BT_ID:      ret = readBtId     ( msgs, in, inlen ); break;
     1592        case AWAITING_BT_MESSAGE: ret = readBtMessage( msgs, in, inlen ); break;
     1593        default:                  assert( 0 );
    15911594    }
    15921595
Note: See TracChangeset for help on using the changeset viewer.