From 1b1370db7261b6629db0267f0e5aeb87e19811b1 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 7 Dec 2017 12:58:34 +0100 Subject: [PATCH] Increase TCP timeout from 5 to 30 While 5 seconds seems to be enough for normal behaviour, we might need more time if the daemon is slowed down .e.g. by strace. --- clusterd | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/clusterd b/clusterd index 3b44b15..60fc54f 100755 --- a/clusterd +++ b/clusterd @@ -531,6 +531,7 @@ use Data::Dumper; our $UDP_MAX=1472; # for broadcast on alphas our $UDP_PORT=234; our $BC_RATE=8; # packets per second broadcast +our $TCP_TIMEOUT=30; # default timeout for tcp processing our (%options); # RUN OPTIONS @@ -1748,7 +1749,7 @@ sub udp_rx_push { } my $s; - $s=My::Select::INET::connect_tcp($ip,$CLP_PORT,5,sub { + $s=My::Select::INET::connect_tcp($ip,$CLP_PORT,$TCP_TIMEOUT,sub { $! and return warn "$ip: $!\n"; send_tcp_cp($s,sub { $! and return warn "$ip: $!\n"; @@ -1765,7 +1766,7 @@ sub udp_rx_push { print $fh $buf; $bytes-=length($buf); if ($bytes>0) { - My::Select::INET::read_with_timeout($s,$cb,5); + My::Select::INET::read_with_timeout($s,$cb,$TCP_TIMEOUT); return; } $cb=undef; @@ -1776,8 +1777,8 @@ sub udp_rx_push { utime($st_want->mtime,$st_want->mtime,$filename); warn "installed $filename\n"; }; - My::Select::INET::read_with_timeout($s,$cb,5); - },5,'PULL',$st_want); + My::Select::INET::read_with_timeout($s,$cb,$TCP_TIMEOUT); + },$TCP_TIMEOUT,'PULL',$st_want); }); }