projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
put in some more loop protection.
[spider.git]
/
perl
/
DXChannel.pm
diff --git
a/perl/DXChannel.pm
b/perl/DXChannel.pm
index d540004e638f2c9ad2051dc487a37433f50f5549..754cd5387127edab92d73b6ebec42a93199b5f05 100644
(file)
--- a/
perl/DXChannel.pm
+++ b/
perl/DXChannel.pm
@@
-51,6
+51,7
@@
use vars qw(%channels %valid);
consort => '9,Connection Type',
'sort' => '9,Type of Channel',
wwv => '0,Want WWV,yesno',
consort => '9,Connection Type',
'sort' => '9,Type of Channel',
wwv => '0,Want WWV,yesno',
+ wx => '0,Want WX,yesno',
talk => '0,Want Talk,yesno',
ann => '0,Want Announce,yesno',
here => '0,Here?,yesno',
talk => '0,Want Talk,yesno',
ann => '0,Want Announce,yesno',
here => '0,Here?,yesno',
@@
-68,6
+69,11
@@
use vars qw(%channels %valid);
pagedata => '9,Page Data Store',
group => '0,Access Group,parray', # used to create a group of users/nodes for some purpose or other
isolate => '9,Isolate network,yesno',
pagedata => '9,Page Data Store',
group => '0,Access Group,parray', # used to create a group of users/nodes for some purpose or other
isolate => '9,Isolate network,yesno',
+ delayed => '9,Delayed messages,parray',
+ annfilter => '9,Announce Filter',
+ wwvfilter => '9,WWV Filter',
+ spotfilter => '9,Spot Filter',
+ passwd => '9,Passwd List,parray',
);
# create a new channel object [$obj = DXChannel->new($call, $msg_conn_obj, $user_obj)]
);
# create a new channel object [$obj = DXChannel->new($call, $msg_conn_obj, $user_obj)]
@@
-78,15
+84,18
@@
sub alloc
die "trying to create a duplicate channel for $call" if $channels{$call};
$self->{call} = $call;
die "trying to create a duplicate channel for $call" if $channels{$call};
$self->{call} = $call;
+ $self->{priv} = 0;
$self->{conn} = $conn if defined $conn; # if this isn't defined then it must be a list
$self->{conn} = $conn if defined $conn; # if this isn't defined then it must be a list
- $self->{user} = $user if defined $user;
+ if (defined $user) {
+ $self->{user} = $user;
+ $self->{lang} = $user->lang;
+ $user->new_group() if !$user->group;
+ $self->{group} = $user->group;
+ }
$self->{startt} = $self->{t} = time;
$self->{state} = 0;
$self->{oldstate} = 0;
$self->{startt} = $self->{t} = time;
$self->{state} = 0;
$self->{oldstate} = 0;
- $self->{lang} = $user->{lang} if defined $user;
$self->{lang} = $main::lang if !$self->{lang};
$self->{lang} = $main::lang if !$self->{lang};
- $user->new_group() if !$user->group;
- $self->{group} = $user->group;
$self->{func} = "";
bless $self, $pkg;
return $channels{$call} = $self;
$self->{func} = "";
bless $self, $pkg;
return $channels{$call} = $self;
@@
-203,6
+212,19
@@
sub msg
return DXM::msg($self->{lang}, @_);
}
return DXM::msg($self->{lang}, @_);
}
+# stick a broadcast on the delayed queue (but only up to 20 items)
+sub delay
+{
+ my $self = shift;
+ my $s = shift;
+
+ $self->{delayed} = [] unless $self->{delayed};
+ push @{$self->{delayed}}, $s;
+ if (@{$self->{delayed}} >= 20) {
+ shift @{$self->{delayed}}; # lose oldest one
+ }
+}
+
# change the state of the channel - lots of scope for debugging here :-)
sub state
{
# change the state of the channel - lots of scope for debugging here :-)
sub state
{
@@
-212,6
+234,12
@@
sub state
$self->{state} = shift;
$self->{func} = '' unless defined $self->{func};
dbg('state', "$self->{call} channel func $self->{func} state $self->{oldstate} -> $self->{state}\n");
$self->{state} = shift;
$self->{func} = '' unless defined $self->{func};
dbg('state', "$self->{call} channel func $self->{func} state $self->{oldstate} -> $self->{state}\n");
+
+ # if there is any queued up broadcasts then splurge them out here
+ if ($self->{delayed} && ($self->{state} eq 'prompt' || $self->{state} eq 'convers')) {
+ $self->send (@{$self->{delayed}});
+ delete $self->{delayed};
+ }
}
return $self->{state};
}
}
return $self->{state};
}
@@
-231,6
+259,22
@@
sub disconnect
$self->del();
}
$self->del();
}
+#
+# just close all the socket connections down without any fiddling about, cleaning, being
+# nice to other processes and otherwise telling them what is going on.
+#
+# This is for the benefit of forked processes to prepare for starting new programs, they
+# don't want or need all this baggage.
+#
+
+sub closeall
+{
+ my $ref;
+ foreach $ref (values %channels) {
+ $ref->{conn}->disconnect() if $ref->{conn};
+ }
+}
+
# various access routines
#
# various access routines
#