From: minima Date: Fri, 7 Sep 2001 21:07:10 +0000 (+0000) Subject: added some diddling to cope with ab5k not always returning a ping X-Git-Tag: R_1_48~45 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=8a43bfdeacbbc78d0ff70df35528f78be39e7485;p=spider.git added some diddling to cope with ab5k not always returning a ping --- diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 056402b9..023daa33 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -1039,19 +1039,28 @@ sub normal $dxchan->send($dxchan->msg('pingi', $from, $s, $ave)) } elsif ($dxchan->is_node) { if ($tochan) { - $tochan->{nopings} = $tochan->user->nopings || 2; # pump up the timer + my $nopings = $tochan->user->nopings || 2; push @{$tochan->{pingtime}}, $t; shift @{$tochan->{pingtime}} if @{$tochan->{pingtime}} > 6; - my $st; - for (@{$tochan->{pingtime}}) { - $st += $_; + + # cope with a missed ping, this means you must set the pingint large enough + my $miss = ($nopings-$tochan->{nopings}) * $tochan->{pingint}; + if ($tochan->is_arcluster && $t > $miss && $t < $miss + $tochan->{nopings} ) { + $t -= $miss; } + + # calc smoothed RTT a la TCP if (@{$tochan->{pingtime}} == 1) { $tochan->{pingave} = $t; } else { $tochan->{pingave} = $tochan->{pingave} + (($t - $tochan->{pingave}) / 8); } +# my $st; +# for (@{$tochan->{pingtime}}) { +# $st += $_; +# } # $tochan->{pingave} = $st / @{$tochan->{pingtime}}; + $tochan->{nopings} = $nopings; # pump up the timer } } }