Ignore:
Timestamp:
Apr 6, 2011, 11:27:11 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) more heap pruning: avoid four unnecessary malloc() + free() calls per tr_peer.

This commit also changes tr_recentHistory from being a general-purpose tool to being a little more hardcoded for the only purpose it's used, in tr_peerMgr. If its files (history.[ch]) don't find any other "customers" in libtransmission, eventually it should be demoted to being a private helper class inside of peer-mgr.c and have the history.[ch] files removed from the build.

File:
1 edited

Legend:

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

    r12308 r12328  
    376376
    377377    peer->have = TR_BITFIELD_INIT;
    378 
    379     tr_historyConstruct( &peer->blocksSentToClient,  CANCEL_HISTORY_SEC, ( RECHOKE_PERIOD_MSEC / 1000 ) );
    380     tr_historyConstruct( &peer->blocksSentToPeer,    CANCEL_HISTORY_SEC, ( RECHOKE_PERIOD_MSEC / 1000 ) );
    381     tr_historyConstruct( &peer->cancelsSentToClient, CANCEL_HISTORY_SEC, ( RECHOKE_PERIOD_MSEC / 1000 ) );
    382     tr_historyConstruct( &peer->cancelsSentToPeer,   CANCEL_HISTORY_SEC, ( REFILL_UPKEEP_PERIOD_MSEC / 1000 ) );
    383378}
    384379
     
    431426        tr_peerIoUnref( peer->io ); /* balanced by the ref in handshakeDoneCB() */
    432427    }
    433 
    434     tr_historyDestruct( &peer->blocksSentToClient  );
    435     tr_historyDestruct( &peer->blocksSentToPeer    );
    436     tr_historyDestruct( &peer->cancelsSentToClient );
    437     tr_historyDestruct( &peer->cancelsSentToPeer   );
    438428
    439429    tr_bitfieldDestruct( &peer->have );
Note: See TracChangeset for help on using the changeset viewer.