Changeset 9599


Ignore:
Timestamp:
Nov 27, 2009, 2:18:32 PM (12 years ago)
Author:
charles
Message:

(trunk) #2614: "incorrect memory usage when not using IPv6" -- accepted dht.c + tr-dht.c patches

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tr-dht.c

    r9549 r9599  
    380380
    381381    event_set( &dht_event, dht_socket, EV_READ, event_callback, NULL );
    382     event_set( &dht6_event, dht6_socket, EV_READ, event_callback, NULL );
    383382    tr_timerAdd( &dht_event, 0, tr_cryptoWeakRandInt( 1000000 ) );
    384     tr_timerAdd( &dht6_event, 0, tr_cryptoWeakRandInt( 1000000 ) );
     383
     384    if( dht6_socket >= 0 )
     385    {
     386        event_set( &dht6_event, dht6_socket, EV_READ, event_callback, NULL );
     387        tr_timerAdd( &dht6_event, 0, tr_cryptoWeakRandInt( 1000000 ) );
     388    }
    385389
    386390    tr_ndbg( "DHT", "DHT initialized" );
     
    411415    tr_ndbg( "DHT", "Uninitializing DHT" );
    412416
    413     event_del(&dht_event);
    414     event_del(&dht6_event);
     417    event_del( &dht_event );
     418
     419    if( dht6_socket >= 0 )
     420        event_del( &dht6_event );
    415421
    416422    /* Since we only save known good nodes, avoid erasing older data if we
  • trunk/third-party/dht/dht.c

    r9549 r9599  
    22292229    CHECK(offset, delta, size);                         \
    22302230    memcpy(buf + offset, src, delta);                   \
    2231     i += delta;
     2231    offset += delta;
    22322232
    22332233#define ADD_V(buf, offset, size)                        \
Note: See TracChangeset for help on using the changeset viewer.