Changeset 5176
- Timestamp:
- Feb 29, 2008, 5:09:33 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-msgs.c
r5172 r5176 1572 1572 { 1573 1573 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 ) 1581 1579 { 1582 1580 ret = READ_DONE; 1583 1581 } 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 } 1584 1588 else switch( msgs->state ) 1585 1589 { 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 ); 1591 1594 } 1592 1595
Note: See TracChangeset
for help on using the changeset viewer.