Changeset 4551


Ignore:
Timestamp:
Jul 5, 2013 8:00:06 AM (7 years ago)
Author:
nanang
Message:

Fix #1685: When TURN destroy is requested in state RESOLVING, pending the destroy until resolver callback is invoked.

File:
1 edited

Legend:

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

    r4537 r4551  
    121121    pj_status_t          last_status; 
    122122    pj_bool_t            pending_destroy; 
    123     pj_bool_t            destroy_notified; 
    124123 
    125124    pj_stun_session     *stun; 
     
    132131    pj_timer_entry       timer; 
    133132 
    134     pj_dns_srv_async_query *dns_async; 
    135133    pj_uint16_t          default_port; 
    136134 
     
    396394        break; 
    397395    case PJ_TURN_STATE_RESOLVING: 
    398         if (sess->dns_async != NULL) { 
    399             pj_dns_srv_cancel_query(sess->dns_async, PJ_FALSE); 
    400             sess->dns_async = NULL; 
    401         } 
     396        /* Wait for DNS callback invoked, it will call the this function 
     397         * again. If the callback happens to get pending_destroy==FALSE, 
     398         * the TURN allocation will call this function again. 
     399         */ 
     400        sess->pending_destroy = PJ_TRUE; 
     401        can_destroy = PJ_FALSE; 
    402402        break; 
    403403    case PJ_TURN_STATE_RESOLVED: 
     
    620620        status = pj_dns_srv_resolve(domain, &res_name, default_port,  
    621621                                    sess->pool, resolver, opt, sess,  
    622                                     &dns_srv_resolver_cb, &sess->dns_async); 
     622                                    &dns_srv_resolver_cb, NULL); 
    623623        if (status != PJ_SUCCESS) { 
    624624            set_state(sess, PJ_TURN_STATE_NULL); 
     
    16831683    unsigned i, cnt, tot_cnt; 
    16841684 
    1685     /* Clear async resolver */ 
    1686     sess->dns_async = NULL; 
    1687  
    16881685    /* Check failure */ 
    1689     if (status != PJ_SUCCESS) { 
     1686    if (status != PJ_SUCCESS || sess->pending_destroy) { 
     1687        set_state(sess, PJ_TURN_STATE_DESTROYING); 
    16901688        sess_shutdown(sess, status); 
    16911689        return; 
Note: See TracChangeset for help on using the changeset viewer.