X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FAranea.pm;h=08d97ce99cc605ed78323a1ec6a0107e35b7d3d3;hb=bab2cc5b932a1b57a8a81e7e815c692169da0d6c;hp=5663b80adc89a337ffe779557f5752fbf32e84b1;hpb=319cdc6c2167b84d93ee1d9c6d219405f4272b82;p=spider.git diff --git a/perl/Aranea.pm b/perl/Aranea.pm index 5663b80a..08d97ce9 100644 --- a/perl/Aranea.pm +++ b/perl/Aranea.pm @@ -126,7 +126,7 @@ sub start unless ($self->{outbound}) { my $thing = Thingy::Rt->new_cf; $thing->broadcast; - $self->lastcf($main::systime); + $main::me->lastcf($main::systime); } # run a script send the output to the debug file @@ -148,7 +148,7 @@ sub normal # periodic processing (every second) # -my $lastmin = 0; +my $lastmin = time; sub process { @@ -160,10 +160,8 @@ sub process $daystart = $main::systime - ($main::systime % 86400); } if ($main::systime >= $lastmin + 60) { - if ($lastmin) { - per_minute(); - $lastmin = $main::systime; - } + per_minute(); + $lastmin = $main::systime; } } @@ -171,24 +169,42 @@ sub per_minute { # send hello and cf packages periodically foreach my $dxchan (DXChannel::get_all()) { - next if $dxchan == $main::me; next if $dxchan->is_aranea; - if ($main::systime > $dxchan->lasthello + $hello_interval) { - my $thing = Thingy::Hello->new(user => $dxchan->call, h => $dxchan->here); + if ($main::systime >= $dxchan->lasthello + $hello_interval) { + my $thing = Thingy::Hello->new(h => $dxchan->here); + $thing->{user} = $dxchan->{call} unless $dxchan == $main::me; + if (my $v = $dxchan->{version}) { + if ($dxchan->is_spider) { + $thing->{sw} = 'DXSp'; + } + $thing->{v} = $v; + } + $thing->{b} = $dxchan->{build} if $dxchan->{build}; $thing->broadcast($dxchan); $dxchan->lasthello($main::systime); } if ($dxchan->is_node) { - if ($main::systime > $dxchan->lasthello + $hello_interval) { + if ($main::systime >= $dxchan->lastcf + $cf_interval) { my $call = $dxchan->call; - my $thing = Thingy::Rt->new(user => $call); - if (my $nref = Route::Node::get($call)) { - $thing->copy_pc16_data($nref); - $thing->broadcast($dxchan); + if ($dxchan == $main::me) { + + # i am special but, currently, still a node + my $thing = Thingy::Rt->new_cf; + $thing->broadcast; $dxchan->lastcf($main::systime); } else { - dbg("Aranea::per_minute: Route::Node for $call disappeared"); - $dxchan->disconnect; + + # i am a pc protocol node connected directly + my $thing = Thingy::Rt->new(); + $thing->{user} = $call unless $dxchan == $main::me; + if (my $nref = Route::Node::get($call)) { + $thing->copy_pc16_data($nref); + $thing->broadcast($dxchan); + $dxchan->lastcf($main::systime); + } else { + dbg("Aranea::per_minute: Route::Node for $call disappeared"); + $dxchan->disconnect; + } } } } @@ -231,7 +247,7 @@ sub disconnect DXProt::route_pc21($self, $main::mycall, undef, @rout) if @rout; # remove outstanding pings -# delete $pings{$call}; + Thingy::Ping::forget($call); # I was the last node visited $self->user->node($main::mycall); @@ -367,7 +383,7 @@ sub input my ($gp, $tus) = split /:/, $group, 2 if $group; $err .= "from me," if $origin eq $main::mycall; - $err .= "invalid group ($gp)," if $gp && $gp !~ /^[A-Z0-9]{2,}$/; + $err .= "invalid group ($gp)," if $gp && $gp !~ /^[-A-Z0-9]{2,}$/; $err .= "invalid tocall ($tus)," if $tus && !is_callsign($tus); $err .= "invalid fromcall ($user)," if $user && !is_callsign($user);