From e9c1322080e18fb8f6f3f0e54bfcbdf3f4da3909 Mon Sep 17 00:00:00 2001 From: minima Date: Sat, 6 Jan 2001 22:24:12 +0000 Subject: [PATCH] fixed set/obscount add new interval types for set/pingint --- Changes | 4 ++++ cmd/Commands_en.hlp | 22 +++++++++++++++++++++- cmd/set/obscount.pl | 18 +++++++++--------- cmd/set/pinginterval.pl | 18 ++++++++++++++---- perl/DXProt.pm | 2 +- perl/Messages | 2 ++ 6 files changed, 51 insertions(+), 15 deletions(-) diff --git a/Changes b/Changes index bc179e72..c2039fb6 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +06Jan01======================================================================= +1. Fix set/obscount so it actually works. +2. Allow different number formats for set/pingint eg: 5m for 5 minutes and +120s for 120 seconds (and 1h for 1 hour). 03Jan01======================================================================= 1. Added a txt directory for txt versions of manuals (g0vgs) 2. Various documentation changes diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 8ab9b000..1cd2b30f 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1053,6 +1053,10 @@ If a ping is heard then the obscount is reset to the full value. Using default values, if a node has not responded to a ping within 15 minutes, it is disconnected. +You can set this parameter between 1 and 9. + +It is STRONGLY recommended that you don't change the default. + === 0^SET/PAGE ^Set the lines per page Tell the system how many lines you wish on a page when the number of line of output from a command is more than this. The default is 20. Setting it @@ -1069,13 +1073,29 @@ affect routing decisions. The default interval is 300 secs or 5 minutes. You can use this command to set a different interval. Please don't. -But if you do the value you enter is treated as minutes up 60 and seconds +But if you do the value you enter is treated as minutes up 30 and seconds for numbers greater than that. This is used also to help determine when a link is down at the far end (as certain cluster software doesn't always notice), see SET/OBSCOUNT for more information. +If you must change it (and it may be useful for internet connected nodes +on dynamic IP addresses that go away after a set time of usage) the time +can be specified as:- + + 5 which if less than 30 is converted to minutes otherwise is + taken as the no of seconds between pings. + 120s 120 seconds + 5m 5 minutes + 1h 1 hour + +Please be aware that this causes traffic to occur on the link, setting +this value too low may annoy your neighbours beyond the point of +endurance! + +You can switch this off by setting it to 0. + === 9^SET/PRIVILEGE [msg('e5')) if $self->priv < 8; -return (1, $self->msg('e14')) unless defined $val; +return (1, $self->msg('e25', 1, 9)) unless defined $val && $val =~ /^\d+$/ && $val >= 1 && $val <= 9; return (1, $self->msg('e12')) unless @args; -$val *= 60 if $val < 120; - foreach $call (@args) { $call = uc $call; + my $dxchan = DXChannel->get($call); + $user = $dxchan->user if $dxchan; $user = DXUser->get_current($call); if ($user) { - unless ($user->sort eq 'A' || $user->sort eq 'S') { + unless ($user->is_node) { push @out, $self->msg('e13', $call); next; } - $user->pingint($val); + $user->nopings($val); if ($dxchan) { - $dxchan->pingint($val); + $dxchan->nopings($val); } else { $user->close(); } - push @out, $self->msg('pingint', $call, $val); + push @out, $self->msg('obscount', $call, $val); } else { - push @out, $self->msg('e3', "Set/Pinginterval", $call); + push @out, $self->msg('e3', "set/obscount", $call); } } return (1, @out); diff --git a/cmd/set/pinginterval.pl b/cmd/set/pinginterval.pl index 45790377..6511c5b6 100644 --- a/cmd/set/pinginterval.pl +++ b/cmd/set/pinginterval.pl @@ -11,14 +11,24 @@ my @args = split /\s+/, $line; my $call; my @out; my $user; -my $val = int shift @args if @args; +my $val = shift @args if @args; -return (1, $self->msg('e5')) if $self->priv < 9; +return (1, $self->msg('e5')) if $self->priv < 8; return (1, $self->msg('e14')) unless defined $val; return (1, $self->msg('e12')) unless @args; -$val *= 60 if $val < 120; +if ($val =~ /^(\d+)[sS]$/) { + $val = $1; +} elsif ($val =~ /^(\d+)[mM]$/) { + $val = $1 * 60; +} elsif ($val =~ /^(\d+)[hH]$/) { + $val = $1 * 60 * 60; +} elsif ($val =~ /^\d+$/) { + $val *= 60 if $val < 30; +} else { + return (1, $self->msg('e14')); +} foreach $call (@args) { $call = uc $call; @@ -26,7 +36,7 @@ foreach $call (@args) { $user = $dxchan->user if $dxchan; $user = DXUser->get($call) unless $user; if ($user) { - unless ($user->sort eq 'A' || $user->sort eq 'S') { + unless ($user->is_node) { push @out, $self->msg('e13', $call); next; } diff --git a/perl/DXProt.pm b/perl/DXProt.pm index e7bda8bc..af94ecac 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -956,7 +956,7 @@ sub normal $dxchan->send($dxchan->msg('pingi', $field[2], $s, $ave)) } elsif ($dxchan->is_node) { if ($tochan) { - $tochan->{nopings} = 2; # pump up the timer + $tochan->{nopings} = $tochan->user->nopings || 2; # pump up the timer push @{$tochan->{pingtime}}, $t; shift @{$tochan->{pingtime}} if @{$tochan->{pingtime}} > 6; my $st; diff --git a/perl/Messages b/perl/Messages index 5ed24fc1..59f96279 100644 --- a/perl/Messages +++ b/perl/Messages @@ -70,6 +70,7 @@ package DXM; e22 => '$_[0] not a callsign', e23 => '$_[0] not a range (eg 0/30000)', e24 => 'Sorry, Internet access is not enabled', + e25 => 'Sorry the value must be between $_[0] and $_[1]', echoon => 'Echoing enabled', echooff => 'Echoing disabled', @@ -156,6 +157,7 @@ package DXM; nodexc => '$_[0] created as DXNET style Node', nodeu => '$_[0] set back as a User', nodee1 => 'You cannot use this command whilst your target ($_[0]) is on-line', + obscount => 'Ping obsolescence count on $_[0] set to $_[1]', ok => 'Operation successful', outconn => 'Outstanding connect to $_[0]', page => 'Press Enter to continue, A to abort ($_[0] lines) >', -- 2.43.0