Ignore:
Timestamp:
Apr 1, 2008 6:23:56 PM (12 years ago)
Author:
bennylp
Message:

More work on ticket #485: bug when TURN UDP relay is not destroyed if Allocate request fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjnath/turn_udp.c

    r1879 r1904  
    156156    sess_cb.on_rx_data = &turn_on_rx_data; 
    157157    sess_cb.on_state = &turn_on_state; 
    158     status = pj_turn_session_create(cfg, pool->obj_name, af, PJ_TURN_TP_UDP, 
     158    status = pj_turn_session_create(cfg, "turn%p", af, PJ_TURN_TP_UDP, 
    159159                                    &sess_cb, udp_rel, 0, &udp_rel->sess); 
    160160    if (status != PJ_SUCCESS) { 
     
    476476 
    477477    if (new_state >= PJ_TURN_STATE_DESTROYING && udp_rel->sess) { 
    478         if (udp_rel->destroy_request) { 
     478 
     479        udp_rel->sess = NULL; 
     480        // Always destroy the session regardless whether application 
     481        // has called pj_turn_udp_destroy() or not. This is to handle 
     482        // the case when Allocate request fails. 
     483        //if (udp_rel->destroy_request) { 
     484        if (1) { 
    479485            pj_time_val delay = {0, 0}; 
    480486 
    481             pj_turn_session_set_user_data(udp_rel->sess, NULL); 
     487            pj_turn_session_set_user_data(sess, NULL); 
     488 
     489            if (udp_rel->timer.id != TIMER_NONE) { 
     490                pj_timer_heap_cancel(udp_rel->timer_heap, &udp_rel->timer); 
     491            } 
    482492 
    483493            udp_rel->timer.id = TIMER_DESTROY; 
    484494            pj_timer_heap_schedule(udp_rel->timer_heap, &udp_rel->timer,  
    485495                                   &delay); 
    486         } else { 
    487             udp_rel->sess = NULL; 
    488496        } 
    489497    } 
Note: See TracChangeset for help on using the changeset viewer.