From: Dirk Koopman Date: Thu, 2 Oct 2008 09:13:18 +0000 (+0100) Subject: Add set/maxconnect command X-Git-Tag: 1.56~67 X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?p=spider.git;a=commitdiff_plain;h=963ead7224e53e257c7c661683174a75c2935cda Add set/maxconnect command --- diff --git a/Changes b/Changes index e84146cb..bcc4bf54 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +02Oct08======================================================================= +1. Add set/maxconnect command to allow the defaults to be overridden for +individual users/nodes. 01Oct08======================================================================= 1. added CTY-1809 prefix data 2. added new config variables to allow an incoming users to have (as default) diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index c7b436aa..86e22d4c 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1659,6 +1659,20 @@ then this command will set your QRA locator for you. For example:- === 9^SET/LOCKOUT ^Stop a callsign connecting to the cluster === 9^UNSET/LOCKOUT ^Allow a callsign to connect to the cluster +=== 8^SET/MAXCONNECT [ ..]^Set max incoming connections for user/node +Set the maximum no of connections (parents) an incoming user or node is +allowed to have. If this incoming connection takes it over the separate +limits for users and nodes (defaults: 3 and 8 respectively), then the +connection is refused (with a polite message). + +The idea behind this to limit the number of copies of messages that +are sent to users (and nodes). Nodes really don't need to have more than +5 or 6 partners and users don't need more than two connections into the +cluster cloud. + +This check is only for INCOMING connections, no check is performed for +outgoing connections. + === 0^SET/NAME ^Set your name Tell the system what your name is eg:- SET/NAME Dirk diff --git a/cmd/set/maxconnect.pl b/cmd/set/maxconnect.pl new file mode 100644 index 00000000..715b355d --- /dev/null +++ b/cmd/set/maxconnect.pl @@ -0,0 +1,31 @@ +# +# set the maximum no of connections this user/node can have +# whilst connecting to this node +# +# Copyright (c) 2008 - Dirk Koopman G1TLH +# + +my ($self, $line) = @_; +my @args = split /\s+/, $line; +my $call; +my @out; +my $user; +my $val = shift @args if @args; + + +return (1, $self->msg('e5')) if $self->priv < 8; +return (1, $self->msg('e14')) unless defined $val; +return (1, $self->msg('e12')) unless @args; + +foreach $call (@args) { + $call = uc $call; + $user = DXUser::get_current($call); + if ($user) { + $user->maxconnect($val); + $user->put; + push @out, $self->msg('maxconnect', $call, $val); + } else { + push @out, $self->msg('e3', "set/maxconnect", $call); + } +} +return (1, @out); diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 3bc4218c..94fa3d1a 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -89,6 +89,7 @@ $v3 = 0; build => '1,Build', believe => '1,Believable nodes,parray', lastping => '1,Last Ping at,ptimelist', + maxconnect => '1,Max Connections', ); #no strict; diff --git a/perl/Messages b/perl/Messages index 38e030f0..a68712c4 100644 --- a/perl/Messages +++ b/perl/Messages @@ -205,6 +205,7 @@ package DXM; m18 => 'Sorry, message $_[0] is currently set to KEEP', m19 => 'Startup Script for $_[0] saved, $_[1] lines', m20 => 'Empty Startup Script for $_[0] deleted', + maxconnect => 'Max connections on $_[0] set to $_[1]', msg1 => 'Bulletin Messages Queued', msg2 => 'Private Messages Queued', msg3 => 'Msg $_[0]: $_[1] changed from $_[2] to $_[3]', diff --git a/perl/Version.pm b/perl/Version.pm index be2a961b..0bddeb20 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,6 +11,6 @@ use vars qw($version $subversion $build); $version = '1.55'; $subversion = '0'; -$build = '28'; +$build = '29'; 1; diff --git a/perl/cluster.pl b/perl/cluster.pl index 46f48183..0bf30659 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -187,12 +187,15 @@ sub new_channel # (fairly) politely disconnect people that are connected to too many other places at once my $r = Route::get($call); - if ($r) { + if ($r && $user) { my @n = $r->parents; - my $v = $r->isa('Route::Node') ? $maxconnect_node : $maxconnect_user; + my $m = $r->isa('Route::Node') ? $maxconnect_node : $maxconnect_user; + my $c = $user->maxconnect; + my $v; + $v = defined $c ? $c : $m; if ($v && @n >= $v) { my $nodes = join ',', @n; - LogDbg('DXCommand', "$call has too many connections ($v) at $nodes, disconnected"); + LogDbg('DXCommand', "$call has too many connections ($v) at $nodes - disconnected"); already_conn($conn, $call, DXM::msg($lang, 'contomany', $call, $v, $nodes)); return; }