Ignore:
Timestamp:
Mar 30, 2006 4:46:36 PM (19 years ago)
Author:
bennylp
Message:

Support for alternate pool backend

File:
1 edited

Legend:

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

    r350 r368  
    9999 
    100100/* Close and reopen socket. */ 
    101 static pj_status_t reopen_sock( pj_sock_t *sock) 
    102 { 
    103     pj_sockaddr_in addr; 
    104     int addrlen; 
     101static pj_status_t reopen_sock( pj_sock_t *sock, pj_sockaddr_in *addr) 
     102{ 
    105103    pj_status_t status; 
    106  
    107     addrlen = sizeof(pj_sockaddr_in); 
    108     status = pj_sock_getsockname(*sock, &addr, &addrlen); 
    109     if (status != PJ_SUCCESS) { 
    110         pjsua_perror(THIS_FILE, "Error getting RTP/RTCP socket name", status); 
    111         return status; 
    112     } 
    113  
    114     pj_sock_close(*sock); 
    115104 
    116105    status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, sock); 
     
    120109    } 
    121110 
    122     status = pj_sock_bind(*sock, &addr, sizeof(pj_sockaddr_in)); 
     111    status = pj_sock_bind(*sock, addr, sizeof(pj_sockaddr_in)); 
    123112    if (status != PJ_SUCCESS) { 
    124113        pjsua_perror(THIS_FILE, "Unable to re-bind RTP/RTCP socket", status); 
     
    142131 
    143132    if (call->session) { 
     133        pj_sockaddr_in rtp_addr, rtcp_addr; 
     134        int addrlen; 
     135 
     136        addrlen = sizeof(rtp_addr); 
     137        pj_sock_getsockname(call->skinfo.rtp_sock, &rtp_addr, &addrlen); 
     138 
     139        addrlen = sizeof(rtcp_addr); 
     140        pj_sock_getsockname(call->skinfo.rtcp_sock, &rtcp_addr, &addrlen); 
     141 
     142        /* Destroy session (this will also close RTP/RTCP sockets). */ 
     143        pjmedia_session_destroy(call->session); 
    144144 
    145145        /* Close and reopen RTP socket. 
     
    147147         * when IOCompletionPort is used. 
    148148         */ 
    149         reopen_sock(&call->skinfo.rtp_sock); 
     149        reopen_sock(&call->skinfo.rtp_sock, &rtp_addr); 
    150150 
    151151        /* Close and reopen RTCP socket too. */ 
    152         reopen_sock(&call->skinfo.rtcp_sock); 
    153  
    154         /* Must destroy session after socket is closed. */ 
    155         pjmedia_session_destroy(call->session); 
     152        reopen_sock(&call->skinfo.rtcp_sock, &rtcp_addr); 
     153 
    156154        call->session = NULL; 
    157155 
Note: See TracChangeset for help on using the changeset viewer.