From 691ed8f646e139115b315cfecaf6b46ada0ba3f4 Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Fri, 31 Jan 2025 14:10:34 +0000 Subject: [PATCH] fix dx,ann cmds, add state to who cmd Also make the node initialisation test to determine whether it was fit for normal traffic work correctly. This was stopping ann/full and other things from working correctly. --- Changes | 5 ++++ cmd/dx.pl | 2 +- cmd/who.pl | 5 ++-- perl/DXProtHandle.pm | 54 ++++++++++++++++++++------------------------ 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/Changes b/Changes index dad23d01..2ab22dfe 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,8 @@ +31Jan25====================================================================== +1. Fixed botched node link initialisation check. This what prevent ann/full + working and would have stopped talk, rcmd etc etc. +2. Added a field called 'state' to the who command to allow sysops to + diagnose some connection initialisation problems. 29Jan25====================================================================== 1. Fix dx command . "I never changed that bit". If I had this would never have happened. diff --git a/cmd/dx.pl b/cmd/dx.pl index 958e7ad1..00ceca4e 100644 --- a/cmd/dx.pl +++ b/cmd/dx.pl @@ -175,7 +175,6 @@ if ($freq =~ /^69/ || $localonly) { $ipaddr ||= $main::mycall; # emergency backstop my $spot = DXProt::pc61($spotter, $freq, $spotted, unpad($line), $ipaddr); -# $self->dx_spot(undef, undef, @spot); if ($self->isslugged) { push @{$self->{sluggedpcs}}, [61, $spot, \@spot]; } else { @@ -183,6 +182,7 @@ if ($freq =~ /^69/ || $localonly) { unless (Spot::dup_find(@spot)) { Spot::dup_add(0, @spot); Spot::add(@spot); + $self->dx_spot(undef, undef, @spot); DXProt::send_dx_spot($self, $spot, @spot); } else { push @out, "Duplicate spot: $line"; diff --git a/cmd/who.pl b/cmd/who.pl index beb224a4..dccd364f 100644 --- a/cmd/who.pl +++ b/cmd/who.pl @@ -11,7 +11,7 @@ my $self = shift; my $dxchan; my @out; -push @out, " Callsign Type Started Name Ave RTT Link"; +push @out, " Callsign Type State Started Name Ave RTT Link"; foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all ) { my $call = $dxchan->call(); @@ -39,7 +39,8 @@ foreach $dxchan ( sort {$a->call cmp $b->call} DXChannel::get_all ) { $ip = $dxchan->hostname; $ip = "AGW Port ($conn->{agwport})" if exists $conn->{agwport}; } - push @out, sprintf "%10s $type $sort $t %-10.10s $ping $ip", $call, $name; + my $state = $dxchan->state; + push @out, sprintf "%10s $type $sort %-8.8s $t %-10.10s $ping $ip", $call, $state, $name; } return (1, @out) diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index ae6e7f86..b33757fc 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -75,6 +75,21 @@ $pc92filterdef = bless ([ ['zone', 'nz', 3], ], 'Filter::Cmd'); +sub check_available +{ + my $self = shift; + my $origin = shift; + my $pcno = shift; + + return 0 if $self == $main::me; + + unless ($self->is_node && $self->state eq 'normal') { + dbg("PC$pcno sent to $self->{call} ignored as this channel is not yet initialised (state: $self-{state})"); + return 1; + } + return 0; +} + our %pc11q; # this is a place to park an incoming PC11 in the sure and certain hope that # a PC61 will be along soon. This has the side benefit that it will delay a @@ -94,12 +109,8 @@ sub handle_10 return; } - unless ($self->state eq 'normal') { - dbg("PC$pcno sent from $self->{call} ignored as this channel is not yet initialised (state: $self-{state})"); - return; - } - - + return if $self->check_available($origin, $pcno); + # is it for me or one of mine? my ($from, $to, $via, $call, $dxchan); $from = $pc->[1]; @@ -167,11 +178,8 @@ sub handle_11 my $pc = shift; my $recurse = shift || 0; - unless ($self->state eq 'normal') { - dbg("PC$pcno sent from $self->{call} ignored as this channel is not yet initialised (state: $self-{state})"); - return; - } - + return if $self->check_available($origin, $pcno); + # route 'foreign' pc26s if ($pcno == 26) { if ($pc->[7] ne $main::mycall) { @@ -583,10 +591,7 @@ sub handle_12 my $origin = shift; my $pc = shift; - unless ($self->state eq 'normal') { - dbg("PC$pcno sent from $self->{call} ignored as this channel is not yet initialised (state: $self-{state})"); - return; - } + return if $self->check_available($origin, $pcno); # announce duplicate checking $pc->[3] =~ s/^\s+//; # remove leading blanks @@ -1523,11 +1528,8 @@ sub handle_41 my $origin = shift; my $pc = shift; - unless ($self->state eq 'normal') { - dbg("PC$pcno sent from $self->{call} ignored as this channel is not yet initialised (state: $self-{state})"); - return; - } - + return unless $self->check_available; + my $call = $pc->[1]; my $sort = $pc->[2]; my $val = $pc->[3]; @@ -1760,10 +1762,7 @@ sub handle_84 my $origin = shift; my $pc = shift; - unless ($self->state eq 'normal') { - dbg("PC$pcno sent from $self->{call} ignored as this channel is not yet initialised (state: $self-{state})"); - return; - } + return if $self->check_available($origin, $pcno); $self->process_rcmd($pc->[1], $pc->[2], $pc->[3], $pc->[4]); } @@ -2476,11 +2475,8 @@ sub handle_93 my $pc = shift; # $self->{do_pc9x} ||= 1; - - unless ($self->state eq 'normal') { - dbg("PC$pcno sent from $self->{call} ignored as this channel is not yet initialised (state: $self-{state})"); - return; - } + + return if $self->check_available($origin, $pcno); my $pcall = $pc->[1]; # this is now checked earlier -- 2.43.0