From: Dirk Koopman Date: Sat, 4 Mar 2023 00:18:41 +0000 (+0000) Subject: fix ping problem X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=a68508856d1efca83b9e21820e906229433dc681;p=spider.git fix ping problem Please look at the Changes for an explanation. I have do the prep work for allowing users to alter the prompt idle timer (currently fixed to 11 minutes). The cmd has yet to be written. --- diff --git a/Changes b/Changes index 8ee7916f..65575f39 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,18 @@ +04Mar23======================================================================= +1. Fixed regression caused by too many command errors in (startup) script + files. This is caused by much stricter checking of commands entered both + by users AND scripts. If there more concurrent errors ie. greater than + $DXChannel::maxerrors (default 10) then that user will be disconnected. + + Unfortunately this could include the $mycall (node) channel if there were + too many command users in the startup script. The example I looked at had + a load of HTML pasted into it. + + For various reasons the only manifestation of this problem was that pings + no longer worked. + + This has been fixed. I am grateful to Fulvio HB9DHG for letting me break + his node for an hour or so until I worked out what was going on. 03Mar23======================================================================= 1. Fix DXDebug::DXDebug not found errors in rarely used functions. This is also an interaction with differing versions of Mojolicious. Clearly this diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index 240142c6..e60ce6c6 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -33,6 +33,8 @@ use DXDebug; use Filter; use Prefix; use Route; +use DXLog; + use strict; use vars qw(%channels %valid @ISA $count $maxerrors); @@ -124,6 +126,7 @@ $count = 0; talk => '0,Want Talk,yesno', talklist => '0,Talk List,parray', user => '9,DXUser ref', + user_interval => '0,Prompt Idle Time', ve7cc => '0,VE7CC program special,yesno', verified => '9,Verified?,yesno', version => '1,Node Version', @@ -135,7 +138,7 @@ $count = 0; wx => '0,Want WX,yesno', ); -$maxerrors = 5; # the maximum number of concurrent errors allowed before disconnection +$maxerrors = 10; # the maximum number of concurrent errors allowed before disconnection # object destruction sub DESTROY @@ -204,12 +207,13 @@ sub _error_out { my $self = shift; my $e = shift; - if (++$self->{errors} > $maxerrors) { + if ($self != $main::me && ++$self->{errors} > $maxerrors) { $self->send($self->msg('e26')); + LogDbg('err', "DXChannel $self->{call}: too many errors ($self->{errors} > $maxerrors), disconnecting"); $self->disconnect; return (); } else { - return ($self->msg($e)); + return ($e ? $self->msg($e) : ''); } } diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index d2f4a4ff..8720e940 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -252,6 +252,7 @@ sub start } $self->lastmsgpoll($main::systime); + $self->{user_interval} = $self->user->user_interval || $main::user_interval; # allow user to change idle time between prompts $self->prompt; } @@ -543,7 +544,7 @@ sub run_cmd # check for length of whole command line and any invalid characters if (length $cmdline > $maxcmdlth || $cmd =~ m|\.| || $cmd !~ m|^\w+(?:/\w+){0,1}(?:/\d+)?$|) { LogDbg('DXCommand', "cmd: $self->{call} - invalid characters in '$cmd'"); - return $self->_error_out('e40'); + return $self->_error_out('e40'); } my ($path, $fcmd); @@ -588,7 +589,7 @@ sub run_cmd return $self->_error_out('e1'); } } else { - dbg("cmd: $cmd not found") if isdbg('command'); + LogDbg('DXCommand', "$self->{call} cmd: '$cmd' not found"); return $self->_error_out('e1'); } } @@ -597,11 +598,7 @@ sub run_cmd if ($ok) { delete $self->{errors}; } else { - if (++$self->{errors} > $DXChannel::maxerrors) { - $self->send($self->msg('e26')); - $self->disconnect; - return (); - } + return $self->_error_out('e26'); } return map {s/([^\s])\s+$/$1/; $_} @ans; } @@ -627,7 +624,7 @@ sub process } # send a prompt if no activity out on this channel - if ($t >= $dxchan->t + $main::user_interval) { + if ($t >= $dxchan->t + $dxchan->{user_interval}) { $dxchan->prompt() if $dxchan->{state} =~ /^prompt/o; $dxchan->t($t); } diff --git a/perl/DXUser.pm b/perl/DXUser.pm index a4e52a26..7481ed84 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -85,6 +85,7 @@ my $json; rbnseeme => '0,RBN See Me,yesno', registered => '9,Registered?,yesno', startt => '0,Start Time,cldatetime', + user_interval => '0,Prompt IdleTime', version => '1,Version', wantann => '0,Req Announce,yesno', wantann_talk => '0,Talklike Anns,yesno',