Ignore:
Timestamp:
Mar 30, 2010 11:13:59 AM (12 years ago)
Author:
nanang
Message:

Ticket #1044:

  • Added initial version of automatic re-registration after registration failure and automatic call disconnection after re-registration attempt fails.
  • Published auto re-registration setting to pjsua app.
  • Updated pjsip_regc_send() to retrieve the transport earlier (was only in tsx_callback()).
  • Fixed TCP and TLS transport to prevent transport deletion in transport disconnection callback.
  • Fixed wrong keep-alive settings used by TLS transport (was using TCP keep-alive settings).
File:
1 edited

Legend:

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

    r3119 r3128  
    185185        return; 
    186186 
     187    /* Prevent immediate transport destroy by application, as transport 
     188     * state notification callback may be stacked and transport instance 
     189     * must remain valid at any point in the callback. 
     190     */ 
     191    pjsip_transport_add_ref(&tls->base); 
     192 
    187193    /* Notify application of transport disconnected state */ 
    188194    state_cb = pjsip_tpmgr_get_status_cb(tls->base.tpmgr); 
     
    201207     */ 
    202208    pjsip_transport_shutdown(&tls->base); 
     209 
     210    /* Now, it is ok to destroy the transport. */ 
     211    pjsip_transport_dec_ref(&tls->base); 
    203212} 
    204213 
     
    518527{ 
    519528    struct tls_transport *tls; 
    520     const pj_str_t ka_pkt = PJSIP_TCP_KEEP_ALIVE_DATA; 
     529    const pj_str_t ka_pkt = PJSIP_TLS_KEEP_ALIVE_DATA; 
    521530    pj_status_t status; 
    522531     
     
    579588    sockaddr_to_host_port(pool, &tls->base.local_name,  
    580589                          (pj_sockaddr_in*)&tls->base.local_addr); 
    581     sockaddr_to_host_port(pool, &tls->base.remote_name, remote); 
     590    if (tls->remote_name.slen) { 
     591        tls->base.remote_name.host = tls->remote_name; 
     592        tls->base.remote_name.port = pj_sockaddr_in_get_port(remote); 
     593    } else { 
     594        sockaddr_to_host_port(pool, &tls->base.remote_name, remote); 
     595    } 
    582596 
    583597    tls->base.endpt = listener->endpt; 
     
    10761090    } else { 
    10771091        /* Start keep-alive timer */ 
    1078         if (PJSIP_TCP_KEEP_ALIVE_INTERVAL) { 
    1079             pj_time_val delay = {PJSIP_TCP_KEEP_ALIVE_INTERVAL, 0}; 
     1092        if (PJSIP_TLS_KEEP_ALIVE_INTERVAL) { 
     1093            pj_time_val delay = {PJSIP_TLS_KEEP_ALIVE_INTERVAL, 0}; 
    10801094            pjsip_endpt_schedule_timer(listener->endpt,  
    10811095                                       &tls->ka_timer,  
     
    15081522 
    15091523    /* Start keep-alive timer */ 
    1510     if (PJSIP_TCP_KEEP_ALIVE_INTERVAL) { 
    1511         pj_time_val delay = { PJSIP_TCP_KEEP_ALIVE_INTERVAL, 0 }; 
     1524    if (PJSIP_TLS_KEEP_ALIVE_INTERVAL) { 
     1525        pj_time_val delay = { PJSIP_TLS_KEEP_ALIVE_INTERVAL, 0 }; 
    15121526        pjsip_endpt_schedule_timer(tls->base.endpt, &tls->ka_timer,  
    15131527                                   &delay); 
     
    15411555    PJ_TIME_VAL_SUB(now, tls->last_activity); 
    15421556 
    1543     if (now.sec > 0 && now.sec < PJSIP_TCP_KEEP_ALIVE_INTERVAL) { 
     1557    if (now.sec > 0 && now.sec < PJSIP_TLS_KEEP_ALIVE_INTERVAL) { 
    15441558        /* There has been activity, so don't send keep-alive */ 
    1545         delay.sec = PJSIP_TCP_KEEP_ALIVE_INTERVAL - now.sec; 
     1559        delay.sec = PJSIP_TLS_KEEP_ALIVE_INTERVAL - now.sec; 
    15461560        delay.msec = 0; 
    15471561 
     
    15711585 
    15721586    /* Register next keep-alive */ 
    1573     delay.sec = PJSIP_TCP_KEEP_ALIVE_INTERVAL; 
     1587    delay.sec = PJSIP_TLS_KEEP_ALIVE_INTERVAL; 
    15741588    delay.msec = 0; 
    15751589 
Note: See TracChangeset for help on using the changeset viewer.