Ignore:
Timestamp:
Feb 14, 2007 2:36:13 PM (18 years ago)
Author:
bennylp
Message:

Fixed ticket #101: PJSUA transport is not updated with correct port number if application specifies port is zero

File:
1 edited

Legend:

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

    r941 r947  
    842842    } 
    843843 
     844    /* If port is zero, get the bound port */ 
     845    if (port == 0) { 
     846        pj_sockaddr_in bound_addr; 
     847        int namelen = sizeof(bound_addr); 
     848        status = pj_sock_getsockname(sock, &bound_addr, &namelen); 
     849        if (status != PJ_SUCCESS) { 
     850            pjsua_perror(THIS_FILE, "getsockname() error", status); 
     851            pj_sock_close(sock); 
     852            return status; 
     853        } 
     854 
     855        port = pj_ntohs(bound_addr.sin_port); 
     856    } 
     857 
    844858    /* Copy and normalize STUN param */ 
    845859    if (use_stun) { 
     
    874888         * address, only set the port. 
    875889         */ 
    876         /* Do nothing */ 
     890        if (p_pub_addr->sin_port == 0) 
     891            p_pub_addr->sin_port = pj_htons((pj_uint16_t)port); 
    877892 
    878893    } else { 
Note: See TracChangeset for help on using the changeset viewer.