Ignore:
Timestamp:
Apr 4, 2011, 4:45:41 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) when reading piece data in from a socket, avoid two unnecessary calls to memcpy()

File:
1 edited

Legend:

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

    r12276 r12303  
    13091309        const size_t nLeft = req->length - evbuffer_get_length( msgs->incoming.block );
    13101310        size_t n = MIN( nLeft, inlen );
    1311         size_t i = n;
    1312         void * buf = tr_sessionGetBuffer( getSession( msgs ) );
    1313         const size_t buflen = SESSION_BUFFER_SIZE;
    1314 
    1315         while( i > 0 )
    1316         {
    1317             const size_t thisPass = MIN( i, buflen );
    1318             tr_peerIoReadBytes( msgs->peer->io, inbuf, buf, thisPass );
    1319             evbuffer_add( msgs->incoming.block, buf, thisPass );
    1320             i -= thisPass;
    1321         }
    1322 
    1323         tr_sessionReleaseBuffer( getSession( msgs ) );
    1324         buf = NULL;
     1311
     1312        tr_peerIoReadBytesToBuf( msgs->peer->io, inbuf, msgs->incoming.block, n );
    13251313
    13261314        fireClientGotData( msgs, n, true );
Note: See TracChangeset for help on using the changeset viewer.