X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProt.pm;h=023daa334e9e03b9545a0d0b0598d6f7adab700e;hb=8a43bfdeacbbc78d0ff70df35528f78be39e7485;hp=056402b9501257fc410ba747e72bfb3e49949e9b;hpb=1478505310c54aa2d6222d12ec129547ab561eb6;p=spider.git 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 } } }