Ignore:
Timestamp:
May 11, 2015 5:57:50 AM (9 years ago)
Author:
ming
Message:

Fixed #1851: Runtime configuration of TCP and TLS keep alive intervals

Thanks to Michele Cicciotti for the patch.

File:
1 edited

Legend:

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

    r5000 r5090  
    11411141            } 
    11421142            /* Start keep-alive timer */ 
    1143             if (PJSIP_TCP_KEEP_ALIVE_INTERVAL) { 
    1144                 pj_time_val delay = {PJSIP_TCP_KEEP_ALIVE_INTERVAL, 0}; 
     1143            if (pjsip_cfg()->tcp.keep_alive_interval) { 
     1144                pj_time_val delay = {pjsip_cfg()->tcp.keep_alive_interval, 0}; 
    11451145                pjsip_endpt_schedule_timer(listener->endpt,  
    11461146                                           &tcp->ka_timer,  
     
    15001500 
    15011501    /* Start keep-alive timer */ 
    1502     if (PJSIP_TCP_KEEP_ALIVE_INTERVAL) { 
    1503         pj_time_val delay = { PJSIP_TCP_KEEP_ALIVE_INTERVAL, 0 }; 
     1502    if (pjsip_cfg()->tcp.keep_alive_interval) { 
     1503        pj_time_val delay = { pjsip_cfg()->tcp.keep_alive_interval, 0 }; 
    15041504        pjsip_endpt_schedule_timer(tcp->base.endpt, &tcp->ka_timer,  
    15051505                                   &delay); 
     
    15271527    PJ_TIME_VAL_SUB(now, tcp->last_activity); 
    15281528 
    1529     if (now.sec > 0 && now.sec < PJSIP_TCP_KEEP_ALIVE_INTERVAL) { 
     1529    if (now.sec > 0 && now.sec < pjsip_cfg()->tcp.keep_alive_interval) { 
    15301530        /* There has been activity, so don't send keep-alive */ 
    1531         delay.sec = PJSIP_TCP_KEEP_ALIVE_INTERVAL - now.sec; 
     1531        delay.sec = pjsip_cfg()->tcp.keep_alive_interval - now.sec; 
    15321532        delay.msec = 0; 
    15331533 
     
    15561556 
    15571557    /* Register next keep-alive */ 
    1558     delay.sec = PJSIP_TCP_KEEP_ALIVE_INTERVAL; 
     1558    delay.sec = pjsip_cfg()->tcp.keep_alive_interval; 
    15591559    delay.msec = 0; 
    15601560 
Note: See TracChangeset for help on using the changeset viewer.