use Route;
use strict;
-use vars qw(%channels %valid @ISA $count);
+use vars qw(%channels %valid @ISA $count $maxerrors);
%channels = ();
$count = 0;
wcyfilter => '5,WCY Filt-out',
spotsfilter => '5,Spot Filt-out',
routefilter => '5,Route Filt-out',
+ pc92filter => '5,PC92 Route Filt-out',
inannfilter => '5,Ann Filt-inp',
inwwvfilter => '5,WWV Filt-inp',
inwcyfilter => '5,WCY Filt-inp',
inspotsfilter => '5,Spot Filt-inp',
inroutefilter => '5,Route Filt-inp',
+ inpc92filter => '5,PC92 Route Filt-inp',
passwd => '9,Passwd List,yesno',
pingint => '5,Ping Interval ',
nopings => '5,Ping Obs Count',
next_pc92_keepalive => '9,Next PC92 KeepAlive,atime',
);
+$maxerrors = 20; # the maximum number of concurrent errors allowed before disconnection
+
# object destruction
sub DESTROY
{
return $channels{$call} = $self;
}
+# count errors and disconnect if too many
+# this has to be here because it can come from rcmd (DXProt) as
+# well as DXCommandmode.
+sub _error_out
+{
+ my $self = shift;
+ my $e = shift;
+ if (++$self->{errors} > $maxerrors) {
+ $self->send($self->msg('e26'));
+ $self->disconnect;
+ return ();
+ } else {
+ return ($self->msg($e));
+ }
+}
+
# rebless this channel as something else
sub rebless
{
return @out;
}
+# return a list of node calls
+sub get_all_node_calls
+{
+ my $ref;
+ my @out;
+ foreach $ref (values %channels) {
+ push @out, $ref->{call} if $ref->is_node;
+ }
+ return @out;
+}
+
# return a list of all users
sub get_all_users
{
# chomp;
my @lines = split /\n/;
for (@lines) {
+ dbg("-> $sort $call $_") if $sort ne 'L' && isdbg('chan');
$conn->send_now("$sort$call|$_");
# debug log it, but not if it is a log message
- dbg("-> $sort $call $_") if $sort ne 'L' && isdbg('chan');
}
}
$self->{t} = time;
# chomp;
my @lines = split /\n/;
for (@lines) {
+ dbg("-> $sort $call $_") if $sort ne 'L' && isdbg('chan');
$conn->send_later("$sort$call|$_");
# debug log it, but not if it is a log message
- dbg("-> $sort $call $_") if $sort ne 'L' && isdbg('chan');
}
}
$self->{t} = time;
for (ref $l ? @$l : $l) {
my @lines = split /\n/;
for (@lines) {
- $conn->send_later("D$call|$_");
dbg("-> D $call $_") if isdbg('chan');
+ $conn->send_later("D$call|$_");
}
}
}
my $user = $self->{user};
$user->close() if defined $user;
- $self->{conn}->disconnect if $self->{conn};
+ $self->{conn}->close_on_empty if $self->{conn};
$self->del();
}