[Freeswitch-users] How to disable TCP Keepalive on a TLS connection?

Steven Ayre steveayre at gmail.com
Fri Aug 23 20:31:27 MSD 2013


SO_KEEPALIVE is defined in the system headers. You shouldn't undefine it.

Rather if you want to tune that code you should patch sofia and mod_sofia
to allow you to do so.


On 23 August 2013 10:35, Master Can <a.daydreamer82 at gmail.com> wrote:

> When digging further into the source code, I found in
> libs\sofia-sip\libsofia-sip-ua\tport\tport_type_tcp.c:
>
> #if defined(SO_KEEPALIVE)
>   setsockopt(socket, SOL_SOCKET, SO_KEEPALIVE, (void *)&val, sizeof val);
> #endif
>   val = 30;
> #if defined(TCP_KEEPIDLE)
>   setsockopt(socket, SOL_TCP, TCP_KEEPIDLE, (void *)&val, sizeof val);
> #endif
> #if defined(TCP_KEEPINTVL)
>   setsockopt(socket, SOL_TCP, TCP_KEEPINTVL, (void *)&val, sizeof val);
> #endif
>
> The 30 seconds are hardcoded...
> Now to turn off keepalive, I'd have to change the header file where
> SO_KEEPALIVE is set and to compile freeswitch?
>
> Is there a more straightforward way?
>
> br,
> Can
>
>
>
>
> 2013/8/23 Master Can <a.daydreamer82 at gmail.com>
>
>> I am not a C/C++ programmer, but I've downloaded the freeswitch source
>> code, and did a search for "tcp_keepalive". I found the variable of type
>> "int" and it is populated with the value tcp-keepalive from the XML file
>> (in sofia.c). But apart from that the variable is not used at all?? Am I
>> overseeing something?
>>
>>
>> 2013/8/22 Master Can <a.daydreamer82 at gmail.com>
>>
>>> Originally the option was not there - so I tried running Freeswitch
>>> without the option already. That didn't influence tcp keepalives though...
>>>
>>>
>>> 2013/8/21 Brian West <brian at freeswitch.org>
>>>
>>>>  Remove the option.
>>>>
>>>> On Aug 21, 2013, at 12:44 PM, Master Can <a.daydreamer82 at gmail.com>
>>>> wrote:
>>>>
>>>> > Hello,
>>>> >
>>>> > I'm running freeswitch 1.2.10, with tls-only.
>>>> > I've tried 2 SIP Useragents now: PhonerLite and CSipSimple.
>>>> >
>>>> > My linux server shows me with netstat --timers that both useragents
>>>> (both server sockets) use keepalive, with a value of 30 seconds.
>>>> >
>>>> > How can I disable keepalive on the TCP layer completely? My
>>>> useragents take care of sending keepalive packets anyway, so Freeswitch
>>>> does not need to do that. It's not mobile friendly, it's eating up battery
>>>> power if the useragents keep receiving keepalive every 30 seconds.
>>>> >
>>>> > I've tried to set
>>>> > <param name="tcp-keepalive" value="disable"/>
>>>> > in internal.xml but to no avail. It didn't change a thing. Setting
>>>> this to 60000 didn't change the output of netstat --timers either.
>>>> >
>>>> > Any advice?
>>>> >
>>>> > best regards,
>>>> > Can
>>>> > _______
>>>>
>>>>
>>>>
>>>> _________________________________________________________________________
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org
>>>> http://www.freeswitchsolutions.com
>>>>
>>>> 
>>>> 
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://wiki.freeswitch.org
>>>> http://www.cluecon.com
>>>>
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:
>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>> http://www.freeswitch.org
>>>>
>>>>
>>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130823/c7c0bc8a/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list