Changeset 5127


Ignore:
Timestamp:
Jul 6, 2015 8:51:45 AM (6 years ago)
Author:
nanang
Message:

Close #1865: Start NAT type detection after first STUN server resolution succeeds to avoid blocked main thread when STUN server is down.

Location:
pjproject/trunk/pjsip/src/pjsua-lib
Files:
2 edited

Legend:

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

    r4957 r5127  
    14641464    if ((result->status == PJ_SUCCESS) && (pjsua_var.ua_cfg.stun_srv_cnt>0)) { 
    14651465        pj_memcpy(&pjsua_var.stun_srv, &result->addr, sizeof(result->addr)); 
     1466 
     1467        /* Perform NAT type detection if not yet */ 
     1468        if (pjsua_var.nat_type == PJ_STUN_NAT_TYPE_UNKNOWN && 
     1469            pjsua_var.ua_cfg.nat_type_in_sdp) 
     1470        { 
     1471            pjsua_detect_nat_type(); 
     1472        } 
    14661473    } 
    14671474} 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r5124 r5127  
    165165 
    166166    /* Perform NAT detection */ 
    167     if (pjsua_var.ua_cfg.stun_srv_cnt) { 
    168         status = pjsua_detect_nat_type(); 
    169         if (status != PJ_SUCCESS) { 
    170             PJ_PERROR(1,(THIS_FILE, status, "NAT type detection failed")); 
    171         } 
    172     } 
     167    // Performed only when STUN server resolution by pjsua_init() completed 
     168    // successfully (see ticket #1865). 
     169    //if (pjsua_var.ua_cfg.stun_srv_cnt) { 
     170        //status = pjsua_detect_nat_type(); 
     171        //if (status != PJ_SUCCESS) { 
     172        //    PJ_PERROR(1,(THIS_FILE, status, "NAT type detection failed")); 
     173        //} 
     174    //} 
    173175 
    174176    pj_log_pop_indent(); 
Note: See TracChangeset for help on using the changeset viewer.