From: Mike Rylander Date: Fri, 15 Aug 2014 23:21:34 +0000 (-0400) Subject: Use TCP keepalive probes in mux mode as well X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e39eda69d0696a0fb0414a837719623e6930433c;p=working%2FSIPServer.git Use TCP keepalive probes in mux mode as well Signed-off-by: Mike Rylander --- 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 $!");