altered pc21 logic
authorminima <minima>
Mon, 9 Apr 2001 20:14:41 +0000 (20:14 +0000)
committerminima <minima>
Mon, 9 Apr 2001 20:14:41 +0000 (20:14 +0000)
disconnect should remove dangling local users

Changes
cmd/disconnect.pl
perl/DXProt.pm
perl/Messages

diff --git a/Changes b/Changes
index 2f05c43d99092c158e29273a502050c053450483..c8428e0be3e251fdf5bd4b4ff3d32f2613e6e3bd 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+10Apr01=======================================================================
+1. altered PC21 logic somewhat to eliminate dup PC21s
+2. disconnect should remove dangling local users in the routing table.
 09Apr01=======================================================================
 1. changed lockfile name to cluster.lck (from .lock) for MSWin's benefit
 08Apr01=======================================================================
index 9e6b67dff927a521d5cb7db530927cf6aec8ef4d..00a462a70e4955b44f252b77621dcb01956f9c50 100644 (file)
@@ -25,6 +25,13 @@ foreach $call (@calls) {
                push @out, $self->msg('disc2', $call);
        } elsif (my $conn = Msg->conns($call)) {
                $conn->disconnect;
+               push @out, $self->msg('disc3', $call);
+       } elsif (my $ref = DXCLuster->get_exact($call)) {
+               my $dxchan = $ref->dxchan;
+               if ($dxchan && $dxchan->call eq $main::mycall) {
+                       $ref->del;
+                       push @out, $self->msg('disc4', $call);
+               }
        } else {
                push @out, $self->msg('e10', $call);
        }
index b0e7b969edf2b07fd05100e77b8be5b658b325e6..6b7d1b949bf363a5c640e2405fef3d38e0e95fec 100644 (file)
@@ -1699,20 +1699,30 @@ sub disconnect
        my $mref = DXMsg::get_busy($call);
        $mref->stop_msg($call) if $mref;
        
-       # broadcast to all other nodes that all the nodes connected to via me are gone
+       # create a list of all the nodes that have gone and delete them from the table
+       my @nodes;
        foreach my $node (grep { $_->dxchan == $self } DXNode::get_all) {
-#              next if $node->call eq $call;
+               next if $node->dxchancall eq $call;
                next if $node->call eq $main::mycall;
-               broadcast_ak1a(pc21($node->call, 'Gone.'), $self) unless $self->{isolate};
+               push @nodes, $node->call;
                $node->del;
        }
 
+       # broadcast to all other nodes that all the nodes connected to via me are gone
+       unless ($self->{isolate}) {
+               push @nodes, $call;
+               for (@nodes) {
+                       broadcast_ak1a(pc21($_, 'Gone.'), $self);
+               }
+       }
+
+       # remove this node from the tables
+       my $node = DXCluster->get_exact($call);
+       $node->del if $node;
+       
        # remove outstanding pings
        delete $pings{$call};
        
-       # now broadcast to all other ak1a nodes that I have gone
-       broadcast_ak1a(pc21($call, 'Gone.'), $self) unless $self->{isolate};
-
        # I was the last node visited
     $self->user->node($main::mycall);
 
index 0a11c0863ddb931c5ab6f758ad3d893a8b38ea2d..c8263d94b0bf0b291275911ad8aa05058d683ce1 100644 (file)
@@ -28,7 +28,9 @@ package DXM;
                                confail => 'connection to $_[0] failed ($_[1])',
                                constart => 'connection to $_[0] started',
                                disc1 => 'Disconnected by $_[0]',
-                               disc2 => '$_[0] disconnected',
+                               disc2 => 'Channel $_[0] disconnected',
+                               disc3 => 'No Channel, but connection $_[0] disconnected',
+                               disc4 => 'No Channel or connection but orphan $_[0] disconnected',
                                db1 => 'This database is hosted at $_[0]',
                                db2 => 'Sorry, but key: $_[0] was not found in $_[1]',
                                db3 => 'Sorry, database $_[0] doesn\'t exist here',