Ignore:
Timestamp:
Mar 25, 2014 4:08:44 AM (10 years ago)
Author:
riza
Message:

Re #1752: Add option to resolve hostname when trying to get network interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transport.c

    r4775 r4802  
    12921292    int af; 
    12931293    pj_sockaddr itf_addr; 
    1294     pj_status_t status; 
     1294    pj_status_t status = -1; 
    12951295 
    12961296    af = (tp_type & PJSIP_TRANSPORT_IPV6)? PJ_AF_INET6 : PJ_AF_INET; 
    1297     status = pj_getipinterface(af, dst, &itf_addr, PJ_FALSE, NULL); 
    1298     if (status != PJ_SUCCESS) { 
    1299         /* If it fails, e.g: on WM6 (http://support.microsoft.com/kb/129065), 
    1300          * just fallback using pj_gethostip(), see ticket #1660. 
    1301          */ 
    1302         PJ_LOG(5,(THIS_FILE,"Warning: unable to determine local " 
    1303                             "interface, fallback to default interface!")); 
    1304         status = pj_gethostip(af, &itf_addr); 
    1305         if (status != PJ_SUCCESS) 
    1306             return status; 
     1297 
     1298    if (pjsip_cfg()->endpt.resolve_hostname_to_get_interface) { 
     1299        status = pj_getipinterface(af, dst, &itf_addr, PJ_TRUE, NULL); 
     1300    } 
     1301 
     1302    if (status != PJ_SUCCESS) {  
     1303        status = pj_getipinterface(af, dst, &itf_addr, PJ_FALSE, NULL); 
     1304        if (status != PJ_SUCCESS) { 
     1305            /* If it fails, e.g: on WM6(http://support.microsoft.com/kb/129065), 
     1306             * just fallback using pj_gethostip(), see ticket #1660. 
     1307             */ 
     1308            PJ_LOG(5,(THIS_FILE,"Warning: unable to determine local " 
     1309                                "interface, fallback to default interface!")); 
     1310            status = pj_gethostip(af, &itf_addr); 
     1311            if (status != PJ_SUCCESS) 
     1312                return status; 
     1313        } 
    13071314    } 
    13081315 
Note: See TracChangeset for help on using the changeset viewer.