$conf = $conf eq '*';
- my $r = Route::User::get($call);
+ # reject this if we think it is a node already
+ my $r = Route::Node::get($call);
+ my $u = DXUser->get_current($call) unless $r;
+ if ($r || ($u && $u->is_node)) {
+ dbg("PCPROT: $call is a node") if isdbg('chanerr');
+ next;
+ }
+
+ $r = Route::User::get($call);
my $flags = Route::here($here)|Route::conf($conf);
if ($r) {
dbg("PCPROT: PC17 from $self->{call} trying to alter locally connected $ncall, ignored!") if isdbg('chanerr');
return;
}
- my $parent = Route::Node::get($ncall);
- unless ($parent) {
- dbg("PCPROT: Route::Node $ncall not in config") if isdbg('chanerr');
- return;
- }
+
my $uref = Route::User::get($ucall);
unless ($uref) {
dbg("PCPROT: Route::User $ucall not in config") if isdbg('chanerr');
return;
}
-
+ my $parent = Route::Node::get($ncall);
+ unless ($parent) {
+ dbg("PCPROT: Route::Node $ncall not in config") if isdbg('chanerr');
+ return;
+ }
# input filter if required
return unless $self->in_filter_route($parent);
$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}+1) * $tochan->{pingint};
+ if ($tochan->is_arcluster && $miss > 0 && $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);
}
- $tochan->{pingave} = $st / @{$tochan->{pingtime}};
+# my $st;
+# for (@{$tochan->{pingtime}}) {
+# $st += $_;
+# }
+# $tochan->{pingave} = $st / @{$tochan->{pingtime}};
+ $tochan->{nopings} = $nopings; # pump up the timer
}
}
}