Skip to content

Commit

Permalink
Increase TCP timeout from 5 to 30
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
donald committed Dec 7, 2017
1 parent fee25eb commit 1b1370d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions clusterd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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";
Expand All @@ -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;
Expand All @@ -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);
});
}

Expand Down

0 comments on commit 1b1370d

Please sign in to comment.