Changeset 12304


Ignore:
Timestamp:
Apr 4, 2011, 5:15:54 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) avoid an unnecessary malloc() + free() call when we finish downloading a block.

Pre-libevent2, this free() was useful in helping keep the peer's incoming piece data buffer from growing too large because that could be a significant amount of wasted space given enough peers. However now that we're using the libevent2 code, that piece data buffer gets handed off to the block cache, so most of the time we're freeing an evbuffer that doesn't have any inernal chains allocated anyway.

File:
1 edited

Legend:

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

    r12303 r12304  
    13201320            return READ_LATER;
    13211321
    1322         /* we've got the whole block ... process it */
     1322        /* pass the block along... */
    13231323        err = clientGotBlock( msgs, msgs->incoming.block, req );
     1324        evbuffer_drain( msgs->incoming.block, evbuffer_get_length( msgs->incoming.block ) );
    13241325
    13251326        /* cleanup */
    1326         evbuffer_free( msgs->incoming.block );
    1327         msgs->incoming.block = evbuffer_new( );
    13281327        req->length = 0;
    13291328        msgs->state = AWAITING_BT_LENGTH;
Note: See TracChangeset for help on using the changeset viewer.