From 6a7585fe8df540f3dba6e0d09d115ce70d8b1aff Mon Sep 17 00:00:00 2001 From: minima Date: Sun, 29 Oct 2000 11:54:55 +0000 Subject: [PATCH] make references in the routing tables callsigns and provide accessors --- Changes | 4 +++- perl/DXCluster.pm | 48 +++++++++++++++++++++++++++++++++++++------ perl/DXCommandmode.pm | 8 ++++---- perl/DXMsg.pm | 18 ++++++++-------- perl/cluster.pl | 2 +- 5 files changed, 59 insertions(+), 21 deletions(-) diff --git a/Changes b/Changes index af1d970e..654c4847 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,9 @@ 29Oct00======================================================================= 1. put in echo cancelling measures into the clients. This doesn't mean you shouldn't take steps to prevent echoing on node links, but it may help where -(whatever you do) it still bloody echos! This is experimental. +(whatever you do) it still bloody echos! This is experimental. +2. store dxchan and mynode as callsigns (and not references) in the routing +tables and do some checking in accessors to see if we can capture some errors. 28Oct00======================================================================= 1. updated show/sun and show/moon from stuff sent by Steve Franke K9AN 2. added show/call which queries jeifer.pineknot.com for any call in the diff --git a/perl/DXCluster.pm b/perl/DXCluster.pm index 21608465..f87dfdfc 100644 --- a/perl/DXCluster.pm +++ b/perl/DXCluster.pm @@ -23,11 +23,11 @@ use vars qw(%cluster %valid); %cluster = (); # this is where we store the dxcluster database %valid = ( - mynode => '0,Parent Node,DXCluster::showcall', + mynode => '0,Parent Node', call => '0,Callsign', confmode => '0,Conference Mode,yesno', here => '0,Here?,yesno', - dxchan => '5,Channel ref,DXCluster::showcall', + dxchan => '5,Channel Call', pcversion => '5,Node Version', list => '5,User List,DXCluster::dolist', users => '0,No of Users', @@ -41,7 +41,7 @@ sub alloc $self->{call} = $call; $self->{confmode} = $confmode; $self->{here} = $here; - $self->{dxchan} = $dxchan; + $self->{dxchan} = $dxchan->call; $cluster{$call} = bless $self, $pkg; return $self; @@ -143,6 +143,42 @@ sub cluster return " $DXNode::nodes nodes, $users local / $tot total users Max users $DXNode::maxusers Uptime $uptime"; } +sub mynode +{ + my $self = shift; + my $noderef = shift; + + if ($noderef) { + $self->{mynode} = $noderef->call; + } else { + $noderef = DXCluster->get_exact($self->{mynode}); + unless ($noderef) { + my $mynode = $self->{mynode}; + my $call = $self->{call}; + dbg('err', "parent node $mynode has disappeared from $call" ); + } + } + return $noderef; +} + +sub dxchan +{ + my $self = shift; + my $dxchan = shift; + + if ($dxchan) { + $self->{dxchan} = $dxchan->call; + } else { + $dxchan = DXChannel->get($self->{dxchan}); + unless ($dxchan) { + my $dxcall = $self->{dxchan}; + my $call = $self->{call}; + dbg('err', "parent dxchan $dxcall has disappeared from $call" ); + } + } + return $dxchan; +} + no strict; sub AUTOLOAD { @@ -178,7 +214,7 @@ sub new die "tried to add $call when it already exists" if DXCluster->get_exact($call); my $self = $pkg->alloc($dxchan, $call, $confmode, $here); - $self->{mynode} = $node; + $self->{mynode} = $node->call; $node->add_user($call, $self); dbg('cluster', "allocating user $call to $node->{call} in cluster\n"); return $self; @@ -188,7 +224,7 @@ sub del { my $self = shift; my $call = $self->{call}; - my $node = $self->{mynode}; + my $node = $self->mynode; $node->del_user($call); dbg('cluster', "deleting user $call from $node->{call} in cluster\n"); @@ -225,7 +261,7 @@ sub new my $self = $pkg->alloc($dxchan, $call, $confmode, $here); $self->{pcversion} = $pcversion; $self->{list} = { } ; - $self->{mynode} = $self; # for sh/station + $self->{mynode} = $self->call; # for sh/station $self->{users} = 0; $nodes++; dbg('cluster', "allocating node $call to cluster\n"); diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index b0d23af2..5f626228 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -401,10 +401,10 @@ sub finish sleep(1); } - if ($call eq $main::myalias) { # unset the channel if it is us really - my $node = DXNode->get($main::mycall); - $node->{dxchan} = 0; - } +# if ($call eq $main::myalias) { # unset the channel if it is us really +# my $node = DXNode->get($main::mycall); +# $node->{dxchan} = 0; +# } # issue a pc17 to everybody interested my $nchan = DXChannel->get($main::mycall); diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 800fb5e7..bd6baf2f 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -612,7 +612,7 @@ sub queue_msg } # deal with routed private messages - my $noderef; + my $dxchan; if ($ref->{private}) { next if $ref->{'read'}; # if it is read, it is stuck here $clref = DXCluster->get_exact($ref->{to}); @@ -621,10 +621,10 @@ sub queue_msg my $hnode = $uref->homenode if $uref; $clref = DXCluster->get_exact($hnode) if $hnode; } - if ($clref && !grep { $clref->{dxchan} == $_ } DXCommandmode::get_all()) { + if ($clref && !grep { $clref->dxchan == $_ } DXCommandmode::get_all()) { next if $clref->call eq $main::mycall; # i.e. it lives here - $noderef = $clref->{dxchan}; - $ref->start_msg($noderef) if !get_busy($noderef->call) && $noderef->state eq 'normal'; + $dxchan = $clref->dxchan; + $ref->start_msg($dxchan) if $dxchan && !get_busy($dxchan->call) && $dxchan->state eq 'normal'; } } @@ -633,13 +633,13 @@ sub queue_msg # the nodelist up above, if there are sites that haven't got it yet # then start sending it - what happens when we get loops is anyone's # guess, use (to, from, time, subject) tuple? - foreach $noderef (@nodelist) { - next if $noderef->call eq $main::mycall; - next if grep { $_ eq $noderef->call } @{$ref->{gotit}}; - next unless $ref->forward_it($noderef->call); # check the forwarding file + foreach $dxchan (@nodelist) { + next if $dxchan->call eq $main::mycall; + next if grep { $_ eq $dxchan->call } @{$ref->{gotit}}; + next unless $ref->forward_it($dxchan->call); # check the forwarding file # if we are here we have a node that doesn't have this message - $ref->start_msg($noderef) if !get_busy($noderef->call) && $noderef->state eq 'normal'; + $ref->start_msg($dxchan) if !get_busy($dxchan->call) && $dxchan->state eq 'normal'; last; } diff --git a/perl/cluster.pl b/perl/cluster.pl index 99322ff3..a645da33 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -368,7 +368,7 @@ DXProt->init(); # put in a DXCluster node for us here so we can add users and take them away -DXNode->new(0, $mycall, 0, 1, $DXProt::myprot_version); +DXNode->new($DXProt::me, $mycall, 0, 1, $DXProt::myprot_version); # read in any existing message headers and clean out old crap dbg('err', "reading existing message headers ..."); -- 2.43.0