X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProt.pm;h=d6ea691796e82c3078f04d8aa1c41cc6e4c50b5e;hb=874ee7e39c3d38f5b52226ced9486af33a7505c4;hp=9d92a8293099060c42bc16cd936b69b4eb358153;hpb=c8b7744ab5cbdada26c56635b20c8d9715104153;p=spider.git diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 9d92a829..d6ea6917 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -570,7 +570,15 @@ sub normal $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) { @@ -621,17 +629,17 @@ sub normal 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); @@ -1031,14 +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}+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 } } }