Ignore:
Timestamp:
May 19, 2016 4:30:05 AM (8 years ago)
Author:
riza
Message:

Re #1918: Fixed continous looping when trying to resolve STUN server due to lock handling.
Also move the unusable server to the least prioritize to be chosen on the fallback process.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r5297 r5307  
    12061206    result.status = sess->status; 
    12071207    result.name = sess->srv[sess->idx]; 
     1208    result.index = sess->idx; 
    12081209    pj_memcpy(&result.addr, &sess->addr, sizeof(result.addr)); 
    12091210    sess->has_result = PJ_TRUE; 
     
    15091510    if ((result->status == PJ_SUCCESS) && (pjsua_var.ua_cfg.stun_srv_cnt>0)) { 
    15101511        pj_memcpy(&pjsua_var.stun_srv, &result->addr, sizeof(result->addr)); 
     1512        pjsua_var.stun_srv_idx = result->index; 
    15111513 
    15121514        /* Perform NAT type detection if not yet */ 
     
    15551557         */ 
    15561558        if (wait) { 
    1557             while (pjsua_var.stun_status == PJ_EPENDING) { 
     1559            pj_bool_t has_pjsua_lock = PJSUA_LOCK_IS_LOCKED(); 
     1560 
     1561            if (has_pjsua_lock) 
     1562                PJSUA_UNLOCK(); 
     1563 
     1564            while (pjsua_var.stun_status == PJ_EPENDING) {               
    15581565                /* If there is no worker thread or 
    15591566                 * the function is called from the only worker thread, 
     
    15691576                } 
    15701577            } 
     1578            if (has_pjsua_lock) 
     1579                PJSUA_LOCK(); 
    15711580        } 
    15721581    } 
Note: See TracChangeset for help on using the changeset viewer.