From e39eda69d0696a0fb0414a837719623e6930433c Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 15 Aug 2014 19:21:34 -0400 Subject: [PATCH] Use TCP keepalive probes in mux mode as well Signed-off-by: Mike Rylander --- SIPServer.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SIPServer.pm b/SIPServer.pm index 1f876ab..1756e99 100755 --- a/SIPServer.pm +++ b/SIPServer.pm @@ -351,6 +351,16 @@ sub mux_input { worker_pipe => IO::Pipe->new }; + # This is kind of kinky, but allows us to avoid requiring Socket::Linux. + # A simple "Socket::Linux"->use won't suffice since we need access to + # all of it's bareword constants as well. + eval <<' EVAL'; + use Socket::Linux qw(TCP_KEEPINTVL TCP_KEEPIDLE TCP_KEEPCNT); + setsockopt($self->{server}->{client}, SOL_SOCKET, SO_KEEPALIVE, 1); + setsockopt($self->{server}->{client}, IPPROTO_TCP, TCP_KEEPIDLE, 120); + setsockopt($self->{server}->{client}, IPPROTO_TCP, TCP_KEEPINTVL, 10); + EVAL + my $pid = fork(); if (!defined($pid) or $pid < 0) { syslog('LOG_ERR', "Unable to fork new child process $!"); -- 2.11.0