make references in the routing tables callsigns and provide accessors
authorminima <minima>
Sun, 29 Oct 2000 11:54:55 +0000 (11:54 +0000)
committerminima <minima>
Sun, 29 Oct 2000 11:54:55 +0000 (11:54 +0000)
Changes
perl/DXCluster.pm
perl/DXCommandmode.pm
perl/DXMsg.pm
perl/cluster.pl

diff --git a/Changes b/Changes
index af1d970e2a6519e64a7efad158e8783dda64257c..654c48472301f8686840f8aa74c6ec9cf97b6201 100644 (file)
--- 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 
index 2160846547e9e542b5c80413c3bc8c1201e46ccf..f87dfdfcf00550318f1e6566a8245d731a3d8d1b 100644 (file)
@@ -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");
index b0d23af25008417324e823732d3efe7b0c5f08a7..5f6262289d7a8db50bc32046fe3fd12fc4a35feb 100644 (file)
@@ -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);
index 800fb5e74b26ce25ee86c1f24b20d006e4e6b31d..bd6baf2fd5935d2bbf3f7bc91047583610537fb5 100644 (file)
@@ -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;
                }
 
index 99322ff3f2c452ab49e9d31578cfec845a572672..a645da33f7325483e66bb348192595e3b9e99fc1 100755 (executable)
@@ -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 ...");