Changeset 5442


Ignore:
Timestamp:
Oct 4, 2016 9:10:11 AM (3 years ago)
Author:
ming
Message:

Fixed #1962: Premature STUN socket destruction when there's an error during STUN server resolution

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h

    r5337 r5442  
    375375    pj_sockaddr          addr;      /**< Result             */ 
    376376    pj_stun_sock        *stun_sock; /**< Testing STUN sock  */ 
     377    pj_bool_t            async_wait;/**< Async resolution  
     378                                         of STUN entry      */ 
    377379} pjsua_stun_resolve; 
    378380 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r5423 r5442  
    12851285                  sess->srv[sess->idx].ptr, errmsg)); 
    12861286 
     1287        if (op == PJ_STUN_SOCK_BINDING_OP && !sess->async_wait) { 
     1288            /* Just return here, we will destroy the STUN socket and 
     1289             * continue the STUN resolution later in resolve_stun_entry(). 
     1290             * For more details, please refer to ticket #19xx. 
     1291             */ 
     1292            return PJ_FALSE; 
     1293        } 
     1294 
    12871295        pj_stun_sock_destroy(stun_sock); 
    12881296        sess->stun_sock = NULL; 
     
    13731381        pj_bzero(&stun_sock_cb, sizeof(stun_sock_cb)); 
    13741382        stun_sock_cb.on_status = &test_stun_on_status; 
     1383        sess->async_wait = PJ_FALSE; 
    13751384        status = pj_stun_sock_create(&pjsua_var.stun_cfg, "stunresolve", 
    13761385                                     pj_AF_INET(), &stun_sock_cb, 
     
    14051414         * stun_sock_cb() 
    14061415         */ 
     1416        sess->async_wait = PJ_TRUE; 
    14071417        return; 
    14081418    } 
Note: See TracChangeset for help on using the changeset viewer.