From 6e1e3dbb021d95286ba02e27ac96d53abdbb3823 Mon Sep 17 00:00:00 2001 From: minima Date: Mon, 9 Apr 2001 20:14:41 +0000 Subject: [PATCH] altered pc21 logic disconnect should remove dangling local users --- Changes | 3 +++ cmd/disconnect.pl | 7 +++++++ perl/DXProt.pm | 22 ++++++++++++++++------ perl/Messages | 4 +++- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Changes b/Changes index 2f05c43d..c8428e0b 100644 --- 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======================================================================= diff --git a/cmd/disconnect.pl b/cmd/disconnect.pl index 9e6b67df..00a462a7 100644 --- a/cmd/disconnect.pl +++ b/cmd/disconnect.pl @@ -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); } diff --git a/perl/DXProt.pm b/perl/DXProt.pm index b0e7b969..6b7d1b94 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -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); diff --git a/perl/Messages b/perl/Messages index 0a11c086..c8263d94 100644 --- a/perl/Messages +++ b/perl/Messages @@ -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', -- 2.34.1