Changeset 12543


Ignore:
Timestamp:
Jul 12, 2011, 12:26:24 PM (10 years ago)
Author:
jordan
Message:

(trunk libT) #4351 "DHT can't be uninitialized during a session" -- don't process incoming DHT messages if DHT is disabled. Don't process incoming UTP messages if UTP is disabled.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

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

    r12270 r12543  
    346346    tr_ndbg( "DHT", "Uninitializing DHT" );
    347347
    348     event_free( dht_timer );
    349     dht_timer = NULL;
     348    if( dht_timer != NULL ) {
     349        event_free( dht_timer );
     350        dht_timer = NULL;
     351    }
    350352
    351353    /* Since we only save known good nodes, avoid erasing older data if we
  • trunk/libtransmission/tr-udp.c

    r12394 r12543  
    210210    if(rc > 0) {
    211211        if( buf[0] == 'd' ) {
    212             buf[rc] = '\0';     /* required by the DHT code */
    213             tr_dhtCallback(buf, rc, (struct sockaddr*)&from, fromlen, sv);
     212            if( tr_sessionAllowsDHT( ss ) ) {
     213                buf[rc] = '\0'; /* required by the DHT code */
     214                tr_dhtCallback(buf, rc, (struct sockaddr*)&from, fromlen, sv);
     215            }
    214216        } else if( rc >= 8 &&
    215217                   buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && buf[3] <= 3 ) {
     
    218220                tr_ndbg("UDP", "Couldn't parse UDP tracker packet.");
    219221        } else {
    220             rc = tr_utpPacket(buf, rc, (struct sockaddr*)&from, fromlen, ss);
    221             if( !rc )
    222                 tr_ndbg("UDP", "Unexpected UDP packet");
     222            if( tr_sessionIsUTPEnabled( ss ) ) {
     223                rc = tr_utpPacket(buf, rc, (struct sockaddr*)&from, fromlen, ss);
     224                if( !rc )
     225                    tr_ndbg("UDP", "Unexpected UDP packet");
     226            }
    223227        }
    224228    }
     
    290294tr_udpUninit(tr_session *ss)
    291295{
     296    tr_dhtUninit(ss);
     297
    292298    if(ss->udp_socket >= 0) {
    293299        tr_netCloseSocket( ss->udp_socket );
Note: See TracChangeset for help on using the changeset viewer.