added some diddling to cope with ab5k not always returning a ping
authorminima <minima>
Fri, 7 Sep 2001 21:07:10 +0000 (21:07 +0000)
committerminima <minima>
Fri, 7 Sep 2001 21:07:10 +0000 (21:07 +0000)
perl/DXProt.pm

index 056402b9501257fc410ba747e72bfb3e49949e9b..023daa334e9e03b9545a0d0b0598d6f7adab700e 100644 (file)
@@ -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
                                                                }
                                                        } 
                                                }