Hi,
I'm currently working on a new module, that allows setting the TCP keepalive options by socket, on demand, through the kamailio cfg:
https://github.com/kamailio/kamailio/tree/coudot/tcp_keepalive/modules/tcp_k...
This allows turning this mechanism on only when needed during the whole lifetime of a SIP/TCP connection. In our case, this would be only during a media session, to efficiently detect a disconnection (clients are smartphones on mobile network). Then, disabling keepalive when the session ends allows to save on network traffic, and battery for the client.
Setting the options on the socket is straightforward when the TCP worker owns the file descriptor, but it's more tricky when it does not. In the latter case, I've been re-using the core functions from pass_fd.c.
Are the functions from pass_fd safe to use from modules? Apart from close()ing the fd after setting the sock options, is there anything to take care of in term of resource locking or releasing?
Any feedback is appreciated.
Cheers,
Hello,
I think it would be good to use a more generic name for the module, such as 'tcpops'.
In the future we may add other functions to tune the tcp connections. Naming it tcp_keepalive bounds it to this single feature.
Cheers, Daniel
On 04/02/15 18:50, Camille Oudot wrote:
Hi,
I'm currently working on a new module, that allows setting the TCP keepalive options by socket, on demand, through the kamailio cfg:
https://github.com/kamailio/kamailio/tree/coudot/tcp_keepalive/modules/tcp_k...
This allows turning this mechanism on only when needed during the whole lifetime of a SIP/TCP connection. In our case, this would be only during a media session, to efficiently detect a disconnection (clients are smartphones on mobile network). Then, disabling keepalive when the session ends allows to save on network traffic, and battery for the client.
Setting the options on the socket is straightforward when the TCP worker owns the file descriptor, but it's more tricky when it does not. In the latter case, I've been re-using the core functions from pass_fd.c.
Are the functions from pass_fd safe to use from modules? Apart from close()ing the fd after setting the sock options, is there anything to take care of in term of resource locking or releasing?
Any feedback is appreciated.
Cheers,
Le Wed, 4 Feb 2015 18:58:38 +0100, Daniel-Constantin Mierla miconda@gmail.com a écrit :
I think it would be good to use a more generic name for the module, such as 'tcpops'.
In the future we may add other functions to tune the tcp connections. Naming it tcp_keepalive bounds it to this single feature.
Hi Daniel,
good point, I'm renaming the module tcpops. What other socket options do you feel could be useful to change on the fly?
cheers
Le Wed, 4 Feb 2015 18:58:38 +0100, Daniel-Constantin Mierla miconda@gmail.com a écrit :
I think it would be good to use a more generic name for the module, such as 'tcpops'.
Hi,
i renamed the module and posted it here:
https://github.com/kamailio/kamailio/tree/coudot/tcpops/modules/tcpops
Cheers
Hello,
you can push the module on the master branch - one more remark:
- use 'tcpops_' prefix for all non-static C functions in the module. In the config they can be exported with 'tcp_' prefix in the name, but in the C code is better to use a prefix that avoids potential conflicts with the core which uses tcp_ ...
Haven't had time to follow up on your previous email, but setting the tcp connection lifetime can be another function in this module -- now it is only a global parameter, iirc. Needs for other functions can arise in the future...
Cheers, Daniel
On 06/02/15 11:28, Camille Oudot wrote:
Le Wed, 4 Feb 2015 18:58:38 +0100, Daniel-Constantin Mierla miconda@gmail.com a écrit :
I think it would be good to use a more generic name for the module, such as 'tcpops'.
Hi,
i renamed the module and posted it here:
https://github.com/kamailio/kamailio/tree/coudot/tcpops/modules/tcpops
Cheers
On 02/06/2015 11:56 AM, Daniel-Constantin Mierla wrote:
Hello,
you can push the module on the master branch
Can we add it to the list of basic modules?
diff --git a/Makefile.groups b/Makefile.groups index 018531a..7d5cb54 100644 --- a/Makefile.groups +++ b/Makefile.groups @@ -14,7 +14,7 @@ mod_list_basic=async auth benchmark blst cfg_rpc cfgutils corex counters \ mediaproxy mi_datagram mi_fifo mi_rpc mqueue \ nat_traversal nathelper path pike pv ratelimit rr rtimer \ rtpproxy sanity sdpops siputils sl statistics textops \
textopsx tm tmx topoh xlog rtpengine stun sipt
textopsx tm tmx topoh xlog rtpengine stun sipt tcpops
# - extra used modules, with no extra dependency mod_list_extra=avp auth_diameter call_control dmq domainpolicy msrp pdb \
Yes, add it to the basic modules.
Cheers, Daniel
On 06/02/15 14:31, Victor Seva wrote:
On 02/06/2015 11:56 AM, Daniel-Constantin Mierla wrote:
Hello,
you can push the module on the master branch
Can we add it to the list of basic modules?
diff --git a/Makefile.groups b/Makefile.groups index 018531a..7d5cb54 100644 --- a/Makefile.groups +++ b/Makefile.groups @@ -14,7 +14,7 @@ mod_list_basic=async auth benchmark blst cfg_rpc cfgutils corex counters \ mediaproxy mi_datagram mi_fifo mi_rpc mqueue \ nat_traversal nathelper path pike pv ratelimit rr rtimer \ rtpproxy sanity sdpops siputils sl statistics textops \
textopsx tm tmx topoh xlog rtpengine stun sipt
textopsx tm tmx topoh xlog rtpengine stun sipt tcpops
# - extra used modules, with no extra dependency mod_list_extra=avp auth_diameter call_control dmq domainpolicy msrp pdb \
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev