Changeset 7535 for trunk/libtransmission/peer-msgs.c
- Timestamp:
- Dec 30, 2008, 12:56:10 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-msgs.c
r7528 r7535 33 33 #include "peer-mgr-private.h" 34 34 #include "peer-msgs.h" 35 #include "platform.h" /* MAX_STACK_ARRAY_SIZE */ 35 36 #include "ratecontrol.h" 36 37 #include "stats.h" … … 1415 1416 const size_t nLeft = req->length - EVBUFFER_LENGTH( msgs->incoming.block ); 1416 1417 size_t n = MIN( nLeft, inlen ); 1417 uint8_t * buf = tr_new( uint8_t, n ); 1418 assert( EVBUFFER_LENGTH( inbuf ) >= n ); 1419 tr_peerIoReadBytes( msgs->peer->io, inbuf, buf, n ); 1420 evbuffer_add( msgs->incoming.block, buf, n ); 1418 size_t i = n; 1419 1420 while( i > 0 ) 1421 { 1422 uint8_t buf[MAX_STACK_ARRAY_SIZE]; 1423 const size_t thisPass = MIN( n, sizeof( buf ) ); 1424 tr_peerIoReadBytes( msgs->peer->io, inbuf, buf, thisPass ); 1425 evbuffer_add( msgs->incoming.block, buf, thisPass ); 1426 i -= thisPass; 1427 } 1428 1421 1429 fireClientGotData( msgs, n, TRUE ); 1422 1430 *setme_piece_bytes_read += n; 1423 tr_free( buf );1424 1431 dbgmsg( msgs, "got %zu bytes for block %u:%u->%u ... %d remain", 1425 1432 n, req->index, req->offset, req->length,
Note: See TracChangeset
for help on using the changeset viewer.