Ignore:
Timestamp:
Apr 17, 2011, 5:55:46 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) heap and event pruning: don't create evtimers for periodic pex messages if the torrent doesn't allow pex (such as, if it's on a private tracker).

Previously, we unconditionally created the evtimer, and then checked each time to see if pex was allowed.

File:
1 edited

Legend:

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

    r12311 r12366  
    23102310    sendPex( msgs );
    23112311
     2312    assert( msgs->pexTimer != NULL );
    23122313    tr_timerAdd( msgs->pexTimer, PEX_INTERVAL_SECS, 0 );
    23132314}
     
    23422343    m->outMessagesBatchPeriod = LOW_PRIORITY_INTERVAL_SECS;
    23432344    m->incoming.block = evbuffer_new( );
    2344     m->pexTimer = evtimer_new( torrent->session->event_base, pexPulse, m );
    23452345    peer->msgs = m;
    2346     tr_timerAdd( m->pexTimer, PEX_INTERVAL_SECS, 0 );
     2346
     2347    if( tr_torrentAllowsPex( torrent ) ) {
     2348        m->pexTimer = evtimer_new( torrent->session->event_base, pexPulse, m );
     2349        tr_timerAdd( m->pexTimer, PEX_INTERVAL_SECS, 0 );
     2350    }
    23472351
    23482352    if( tr_peerIoSupportsUTP( peer->io ) ) {
     
    23772381    if( msgs )
    23782382    {
    2379         event_free( msgs->pexTimer );
     2383        if( msgs->pexTimer != NULL )
     2384            event_free( msgs->pexTimer );
    23802385
    23812386        evbuffer_free( msgs->incoming.block );
Note: See TracChangeset for help on using the changeset viewer.