From 766014807e2521cc60a219c6eda5b49d13ffc70f Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Tue, 7 Mar 2023 23:06:26 +0000 Subject: [PATCH] fix allow 2/more commands on a line See Changes for details Also send debug before loading caches, so you know what you are waiting for. --- Changes | 8 ++++++++ perl/AnnTalk.pm | 5 ++++- perl/DXCommandmode.pm | 31 +++++++++++++++++++------------ perl/Geomag.pm | 5 ++++- perl/WCY.pm | 4 +++- perl/cluster.pl | 18 +++++++++--------- 6 files changed, 47 insertions(+), 24 deletions(-) diff --git a/Changes b/Changes index fdfdb9a6..9a4307e4 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,14 @@ 07Mar23======================================================================= 1. Fix odd (and old) regression dx command (line ending 59+++) '++' being the culprit. +2. Allow multiple commands on one line when separated with the 2 character + string '\n' (sigh). +3. Move a few init things about on startup so that more parameters are + scriptable. +4. Put some debug comments before loading various caches (that might take a + longgggg time) and then tell people how long each cache load took. This + should reduce the worry that something is "wrong" when there is a delay + (such as searching for announces). 06Mar23======================================================================= 1. Fix filter error reporting, including incrementing concurrent error count if there are actually any detected parse errors. diff --git a/perl/AnnTalk.pm b/perl/AnnTalk.pm index 8c702e4e..71bd272f 100644 --- a/perl/AnnTalk.pm +++ b/perl/AnnTalk.pm @@ -16,6 +16,7 @@ use DXDebug; use DXDupe; use DXLog; use DXLogPrint; +use Time::HiRes qw(gettimeofday tv_interval); use vars qw(%dup $duplth $dupage $filterdef); @@ -45,10 +46,12 @@ our @anncache; sub init { + my $t0 = [gettimeofday]; + dbg("AnnTalk: loading up to $maxcache announcements into cache"); @anncache = DXLog::search(0, $maxcache, $main::systime, 'ann'); shift @anncache while @anncache > $maxcache; my $l = @anncache; - dbg("AnnTalk: loaded last $l announcements into cache"); + dbg("AnnTalk: loaded last $l announcements into cache in " . _diffms($t0) . "mS"); } sub add_anncache diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index d1feb3e1..dfaaa3e3 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -349,22 +349,26 @@ sub normal } $self->state('prompt'); delete $self->{talklist}; - } elsif ($cmdline =~ m|^/+\w+|) { + } elsif ($cmdline =~ m|^[/\w\\]+|) { $cmdline =~ s|^/||; my $sendit = $cmdline =~ s|^/+||; if (@bad = BadWords::check($cmdline)) { $self->badcount(($self->badcount||0) + @bad); LogDbg('DXCommand', "$self->{call} swore: '$cmdline' with badwords: '" . join(',', @bad) . "'"); } else { - my @in = $self->run_cmd($cmdline); - $self->send_ans(@in); - if ($sendit && $self->{talklist} && @{$self->{talklist}}) { - foreach my $l (@in) { - for (@{$self->{talklist}}) { - if ($self->{state} eq 'talk') { - $self->send_talks($_, $l); - } else { - send_chats($self, $_, $l) + my @cmd = split /\s*\\n\s*/, $cmdline; + foreach my $l (@cmd) { + my @in = $self->run_cmd($l); + $self->send_ans(@in); + if ($sendit && $self->{talklist} && @{$self->{talklist}}) { + foreach my $l (@in) { + for (@{$self->{talklist}}) { + if ($self->{state} eq 'talk') { + $self->send_talks($_, $l); + } + else { + send_chats($self, $_, $l) + } } } } @@ -410,8 +414,11 @@ sub normal # if (@bad = BadWords::check($cmdline)) { # $self->badcount(($self->badcount||0) + @bad); # LogDbg('DXCommand', "$self->{call} swore: '$cmdline' with badwords: '" . join(',', @bad) . "'"); -# } else { - $self->send_ans(run_cmd($self, $cmdline)); + # } else { + my @cmd = split /\s*\\n\s*/, $cmdline; + foreach my $l (@cmd) { + $self->send_ans(run_cmd($self, $l)); + } # } } diff --git a/perl/Geomag.pm b/perl/Geomag.pm index 9b4421d8..f8a1ec72 100644 --- a/perl/Geomag.pm +++ b/perl/Geomag.pm @@ -17,6 +17,7 @@ use Julian; use IO::File; use DXDebug; use DXDupe; +use Time::HiRes qw(gettimeofday tv_interval); use strict; @@ -63,9 +64,11 @@ sub init $fp = DXLog::new('wwv', 'dat', 'm'); do "$param" if -e "$param"; # read in existing data + my $t0 = [gettimeofday]; + dbg(sprintf "WWV read in upto %d records into cache", $maxcache); @cache = readfile($main::systime); shift @cache while @cache > $maxcache; - dbg(sprintf "WWV read in last %d records into cache", scalar @cache); + dbg(sprintf "WWV read in last %d records into cache in %dmS", scalar @cache, _diffms($t0)); confess $@ if $@; } diff --git a/perl/WCY.pm b/perl/WCY.pm index 534d89d7..ef536ddb 100644 --- a/perl/WCY.pm +++ b/perl/WCY.pm @@ -16,6 +16,7 @@ use Julian; use IO::File; use DXDebug; use Data::Dumper; +use Time::HiRes qw(gettimeofday tv_interval); use strict; @@ -64,9 +65,10 @@ sub init $fp = DXLog::new('wcy', 'dat', 'm'); do "$param" if -e "$param"; # read in existing data + my $t0 = [gettimeofday]; @cache = readfile($main::systime); shift @cache while @cache > $maxcache; - dbg(sprintf "WCY read in last %d records into cache", scalar @cache); + dbg(sprintf "WCY read in last %d records into cache %dmS", scalar @cache, _diffms($t0)); confess $@ if $@; } diff --git a/perl/cluster.pl b/perl/cluster.pl index b6c38166..93e769ba 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -633,9 +633,6 @@ sub setup_start Filter::init(); # doesn't do much, but has to be done - AnnTalk::init(); # initialise announce cache - - # look for the sysop and the alias user and complain if they aren't there { @@ -727,12 +724,6 @@ sub setup_start dbg("Read in Aliases"); CmdAlias->init(); - # initialise the Geomagnetic data engine - dbg("Start WWV"); - Geomag->init(); - dbg("Start WCY"); - WCY->init(); - # initialise the protocol engine dbg("Start Protocol Engines ..."); DXProt->init(); @@ -741,6 +732,15 @@ sub setup_start my $script = new Script "startup"; $script->run($main::me) if $script; + + # initialise the Geomagnetic data engine + dbg("Start WWV"); + Geomag->init(); + dbg("Start WCY"); + WCY->init(); + AnnTalk::init(); # initialise announce cache + + # put in a DXCluster node for us here so we can add users and take them away $routeroot = Route::Node->new($mycall, $version*100+5300, Route::here($main::me->here)|Route::conf($main::me->conf)); $routeroot->do_pc9x(1); -- 2.43.0