From 85564500ce87c832f2a99fd96ccc1775dc896a0d Mon Sep 17 00:00:00 2001 From: djk Date: Fri, 18 Jun 1999 14:12:01 +0000 Subject: [PATCH] 1. fixed a problem with DXLogPrint repeating log entries. 2. altered the permissions on disconnnect so that priv 5 users can disconnect clusters, but still require priv 8 to disconnect users. 3. made sure that an incoming PC18 clears out all the cluster info for that channel before re-initialising. 4. add init command. 5. disconnect users before nodess on shutdown --- Changes | 8 ++++++++ cmd/disconnect.pl | 33 +++++++++++++++++---------------- cmd/forward/mail.pl | 0 cmd/init.pl | 35 +++++++++++++++++++++++++++++++++++ cmd/show/log.pl | 2 +- perl/DXLogPrint.pm | 21 ++++++++++++--------- perl/DXProt.pm | 10 +++++++++- perl/Messages | 1 + perl/cluster.pl | 16 +++++++++++++++- 9 files changed, 98 insertions(+), 28 deletions(-) create mode 100644 cmd/forward/mail.pl create mode 100644 cmd/init.pl diff --git a/Changes b/Changes index 17d937a7..3fd33ec3 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,11 @@ +18Jun99======================================================================= +1. fixed a problem with DXLogPrint repeating log entries. +2. altered the permissions on disconnnect so that priv 5 users can disconnect +clusters, but still require priv 8 to disconnect users. +3. made sure that an incoming PC18 clears out all the cluster info for +that channel before re-initialising. +4. add init command. +5. disconnect users before nodess on shutdown 15Jun99======================================================================= 1. added grepdbg program (so you can search your debug files and get times and dates of incidents). diff --git a/cmd/disconnect.pl b/cmd/disconnect.pl index e8e83b89..02f9f45c 100644 --- a/cmd/disconnect.pl +++ b/cmd/disconnect.pl @@ -6,25 +6,26 @@ my @calls = split /\s+/, $line; my $call; my @out; -if ($self->priv < 8) { - return (1, $self->msg('e5')); +if ($self->priv < 5) { + return (1, $self->msg('e5')); } foreach $call (@calls) { - $call = uc $call; - next if $call eq $main::mycall; - my $dxchan = DXChannel->get($call); - if ($dxchan) { - if ($dxchan->is_ak1a) { - $dxchan->send_now("D", DXProt::pc39($main::mycall, $self->msg('disc1', $self->call))); - } else { - $dxchan->send_now('D', $self->msg('disc1', $self->call)); - } - $dxchan->disconnect; - push @out, $self->msg('disc2', $call); - } else { - push @out, $self->msg('e10', $call); - } + $call = uc $call; + next if $call eq $main::mycall; + my $dxchan = DXChannel->get($call); + if ($dxchan) { + if ($dxchan->is_ak1a) { + $dxchan->send_now("D", DXProt::pc39($main::mycall, $self->msg('disc1', $self->call))); + } else { + return (1, $self->msg('e5')) if $self->priv < 8; + $dxchan->send_now('D', $self->msg('disc1', $self->call)); + } + $dxchan->disconnect; + push @out, $self->msg('disc2', $call); + } else { + push @out, $self->msg('e10', $call); + } } return (1, @out); diff --git a/cmd/forward/mail.pl b/cmd/forward/mail.pl new file mode 100644 index 00000000..e69de29b diff --git a/cmd/init.pl b/cmd/init.pl new file mode 100644 index 00000000..bfcb9bd2 --- /dev/null +++ b/cmd/init.pl @@ -0,0 +1,35 @@ +# +# reinit a cluster connection +# +my ($self, $line) = @_; +my @calls = split /\s+/, $line; +my $call; +my @out; + +return (1, $self->msg('e5')) if $self->priv < 5; + +foreach $call (@calls) { + $call = uc $call; + next if $call eq $main::mycall; + my $dxchan = DXChannel->get($call); + if ($dxchan) { + if ($dxchan->is_ak1a) { + + # first clear out any nodes on this dxchannel + my @gonenodes = map { $_->dxchan == $dxchan ? $_ : () } DXNode::get_all(); + foreach my $node (@gonenodes) { + next if $dxchan == $DXProt::me; + DXProt::broadcast_ak1a(DXProt::pc21($node->call, 'Gone, re-init') , $dxchan) unless $dxchan->{isolate}; + $node->del(); + } + $dxchan->send(DXProt::pc38()); + $dxchan->send(DXProt::pc18()); + push @out, $self->msg('init1', $call); + } + } else { + push @out, $self->msg('e10', $call); + } +} + +return (1, @out); + diff --git a/cmd/show/log.pl b/cmd/show/log.pl index 106bfd47..26b99ef2 100644 --- a/cmd/show/log.pl +++ b/cmd/show/log.pl @@ -7,7 +7,7 @@ # my $self = shift; -return (1, $self->msg('e5')) if $self->priv < 9; +return (1, $self->msg('e5')) if $self->priv < 6; my $cmdline = shift; my @f = split /\s+/, $cmdline; diff --git a/perl/DXLogPrint.pm b/perl/DXLogPrint.pm index 3c020357..b287413d 100644 --- a/perl/DXLogPrint.pm +++ b/perl/DXLogPrint.pm @@ -25,15 +25,15 @@ use strict; # sub print { - my $self = $DXLog::log; + my $fcb = $DXLog::log; my $from = shift; my $to = shift; - my @date = $self->unixtoj(shift); + my @date = Julian::unixtojm(shift); my $pattern = shift; my $who = uc shift; my $search; my @in; - my @out; + my @out = (); my $eval; my $count; @@ -55,25 +55,28 @@ sub print } ); - $self->close; # close any open files + $fcb->close; # close any open files - my $fh = $self->open(@date); + my $fh = $fcb->open(@date); for ($count = 0; $count < $to; ) { - my @spots = (); + my $ref; if ($fh) { + @in = (); while (<$fh>) { chomp; - push @in, [ split '\^' ]; + $ref = [ split '\^' ]; + push @{$ref}, "" unless @{$ref} >= 4; + push @in, $ref; } eval $eval; # do the search on this file last if $count >= $to; # stop after n return ("Log search error", $@) if $@; } - $fh = $self->openprev(); # get the next file + $fh = $fcb->openprev(); # get the next file last if !$fh; } - return @out if defined @out; + return @out; } # diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 16b67023..4cf7db7f 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -371,9 +371,17 @@ sub normal } if ($pcno == 18) { # link request + $self->state('init'); + + # first clear out any nodes on this dxchannel + my @gonenodes = map { $_->dxchan == $self ? $_ : () } DXNode::get_all(); + foreach my $node (@gonenodes) { + next if $node->dxchan == $DXProt::me; + broadcast_ak1a(pc21($node->call, 'Gone, re-init') , $self) unless $self->{isolate}; + $node->del(); + } $self->send_local_config(); $self->send(pc20()); - $self->state('init'); return; # we don't pass these on } diff --git a/perl/Messages b/perl/Messages index e2be0e3f..956778bf 100644 --- a/perl/Messages +++ b/perl/Messages @@ -54,6 +54,7 @@ package DXM; hnodee1 => 'Please enter your Home Node, set/homenode ', hnodee2 => 'Failed to set homenode on $_[0]', hnode => 'Your Homenode is now \"$_[0]\"', + init1 => 'sent initialisation message to $_[0]', iso => '$_[0] Isolated', isou => '$_[0] UnIsolated', isoc => '$_[0] created and Isolated', diff --git a/perl/cluster.pl b/perl/cluster.pl index 5b43496e..94fe0478 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -174,8 +174,22 @@ sub cease Local::finish(); # end local processing }; dbg('local', "Local::finish error $@") if $@; - + + # disconnect users + foreach $dxchan (DXChannel->get_all()) { + next if $dxchan->is_ak1a; + disconnect($dxchan) unless $dxchan == $DXProt::me; + } + Msg->event_loop(1, 0.05); + Msg->event_loop(1, 0.05); + Msg->event_loop(1, 0.05); + Msg->event_loop(1, 0.05); + Msg->event_loop(1, 0.05); + Msg->event_loop(1, 0.05); + + # disconnect nodes foreach $dxchan (DXChannel->get_all()) { + next unless $dxchan->is_ak1a; disconnect($dxchan) unless $dxchan == $DXProt::me; } Msg->event_loop(1, 0.05); -- 2.43.0