X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProt.pm;h=056402b9501257fc410ba747e72bfb3e49949e9b;hb=363839f98405239478bbe5a85efad1d679a1c722;hp=51348c82c0cb6e94e282fe922a46284db377cbb3;hpb=47597a3f8635c4d4de89419c0c808ddcda59b9d5;p=spider.git diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 51348c82..056402b9 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -254,15 +254,14 @@ sub start $self->{pingint} = $ping; $self->{nopings} = $user->nopings || 2; $self->{pingtime} = [ ]; - $self->{pingave} = 0; + $self->{pingave} = 999; + $self->{lastping} = $main::systime; # send initialisation string unless ($self->{outbound}) { $self->send(pc18()); - $self->{lastping} = $main::systime; - } else { - $self->{lastping} = $main::systime + ($self->pingint / 2); } + $self->state('init'); $self->{pc50_t} = $main::systime; @@ -571,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) { @@ -622,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); @@ -654,7 +661,7 @@ sub normal # first clear out any nodes on this dxchannel my $parent = Route::Node::get($self->{call}); my @rout = $parent->del_nodes; - $self->route_pc21(@rout, $parent); + $self->route_pc21(@rout, $parent) if @rout; $self->send_local_config(); $self->send(pc20()); return; # we don't pass these on @@ -753,6 +760,7 @@ sub normal $self->send_local_config(); $self->send(pc22()); $self->state('normal'); + $self->{lastping} = 0; return; } @@ -798,6 +806,7 @@ sub normal if ($pcno == 22) { $self->state('normal'); + $self->{lastping} = 0; return; } @@ -1037,7 +1046,12 @@ sub normal for (@{$tochan->{pingtime}}) { $st += $_; } - $tochan->{pingave} = $st / @{$tochan->{pingtime}}; + if (@{$tochan->{pingtime}} == 1) { + $tochan->{pingave} = $t; + } else { + $tochan->{pingave} = $tochan->{pingave} + (($t - $tochan->{pingave}) / 8); + } +# $tochan->{pingave} = $st / @{$tochan->{pingtime}}; } } } @@ -1405,7 +1419,7 @@ sub send_local_config # create a list of all the nodes that are not connected to this connection # and are not themselves isolated, this to make sure that isolated nodes # don't appear outside of this node - my @dxchan = grep { $_->call ne $main::mycall && $_->call ne $self->{call} } DXChannel::get_all_nodes(); + my @dxchan = grep { $_->call ne $main::mycall && $_ != $self && !$_->{isolate} } DXChannel::get_all_nodes(); @localnodes = map { my $r = Route::Node::get($_->{call}); $r ? $r : () } @dxchan if @dxchan; my @intcalls = map { $_->nodes } @localnodes if @localnodes; my $ref = Route::Node::get($self->{call}); @@ -1726,6 +1740,8 @@ sub disconnect my $pc39flag = shift; my $call = $self->call; + return if $self->{disconnecting}++; + unless ($pc39flag && $pc39flag == 1) { $self->send_now("D", DXProt::pc39($main::mycall, $self->msg('disc1', "System Op"))); } @@ -1787,7 +1803,7 @@ sub send_route for (; @_ && $no; $no--) { my $r = shift; - if ($self->{routefilter}) { + if (!$self->{isolate} && $self->{routefilter}) { $filter = undef; if ($r) { ($filter, $hops) = $self->{routefilter}->it($self->{call}, $self->{dxcc}, $self->{itu}, $self->{cq}, $r->call, $r->dxcc, $r->itu, $r->cq); @@ -1800,7 +1816,7 @@ sub send_route dbg("was sent a null value") if isdbg('chanerr'); } } else { - push @rin, $r; + push @rin, $r unless $self->{isolate} && $r->call ne $main::mycall; } } if (@rin) { @@ -1825,13 +1841,11 @@ sub broadcast_route my $dxchan; my $line; - foreach $dxchan (@dxchan) { - next if $dxchan == $self; - next if $dxchan == $me; - if ($dxchan->{routefilter}) { + unless ($self->{isolate}) { + foreach $dxchan (@dxchan) { + next if $dxchan == $self; + next if $dxchan == $me; $dxchan->send_route($generate, @_); - } else { - $dxchan->send_route($generate, @_) unless $self->{isolate} || $dxchan->{isolate}; } } }