30Mar01=======================================================================
1. fix errors on accept in ExtMsg and in Msg
2. fix the non-blocking problems of connects (and other things in general).
+non-blocking only works for unix implementations at the moment.
+3. add rinit command (sends a PC20)
29Mar01=======================================================================
1. add better tracking of AGW circuits (possibly)
2. add set and unset/agwmonitor (ing) [for all the notice it seems to take]
#
-# reinit a cluster connection
+# init a cluster connection
#
# Copyright (c) 1999 Dirk Koopman G1TLH
#
DXProt::broadcast_ak1a(DXProt::pc21($node->call, 'Gone, re-init') , $dxchan) unless $dxchan->{isolate};
$node->del();
}
- $dxchan->send(DXProt::pc38());
+# $dxchan->send(DXProt::pc38());
$dxchan->send(DXProt::pc18());
$dxchan->state('init');
push @out, $self->msg('init1', $call);
--- /dev/null
+#
+# reverse init a cluster connection
+#
+# Copyright (c) 1999 Dirk Koopman G1TLH
+#
+# $Id$
+#
+my ($self, $line) = @_;
+my @calls = split /\s+/, $line;
+my $call;
+my @out;
+
+return (1, $self->msg('e5')) if $self->priv < 5;
+
+foreach $call (@calls) {
+ $call = uc $call;
+ next if $call eq $main::mycall;
+ my $dxchan = DXChannel->get($call);
+ if ($dxchan) {
+ if ($dxchan->is_node) {
+
+ # first clear out any nodes on this dxchannel
+ my @gonenodes = grep { $_->dxchan == $dxchan } DXNode::get_all();
+ foreach my $node (@gonenodes) {
+ next if $node->dxchan == $DXProt::me;
+ next unless $node->dxchan == $dxchan;
+ DXProt::broadcast_ak1a(DXProt::pc21($node->call, 'Gone, re-init') , $dxchan) unless $dxchan->{isolate};
+ $node->del();
+ }
+# $dxchan->send(DXProt::pc38());
+ $dxchan->send(DXProt::pc20());
+ $dxchan->state('init');
+ push @out, $self->msg('init1', $call);
+ }
+ } else {
+ push @out, $self->msg('e10', $call);
+ }
+}
+
+return (1, @out);
+
for (@main::listeners) {
$_->close_server;
}
- unless ($^O =~ /^MS/) {
+ unless ($main::is_win) {
$SIG{HUP} = 'IGNORE';
$SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT';
alarm(0);
delete $conn->{cmd};
$conn->{timeout}->del if $conn->{timeout};
delete $conn->{timeout};
- $conn->_send_file("$main::data/connected");
- Msg->sleep(1);
&{$conn->{rproc}}($conn, "$dir$call|$sort");
+ $conn->_send_file("$main::data/connected");
}
sub new_client {
*STDOUT = IO::File->new_from_fd($b, 'w') or die;
*STDERR = IO::File->new_from_fd($b, 'w') or die;
close $a;
- unless ($^O =~ /^MS/) {
+ unless ($main::is_win) {
# $SIG{HUP} = 'IGNORE';
$SIG{HUP} = $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = 'DEFAULT';
alarm(0);
if ($f) {
while (<$f>) {
chomp;
+ dbg('connll', $_);
$conn->send_raw($_ . $conn->{lineend});
}
$f->close;
eval {
require POSIX; POSIX->import(qw(O_NONBLOCK F_SETFL F_GETFL))
};
- if ($@) {
+ if ($@ || $main::is_win) {
print STDERR "POSIX Blocking *** NOT *** supported $@\n";
+ $blocking_supported = 0;
} else {
$blocking_supported = 1;
print STDERR "POSIX Blocking enabled\n";
$call ||= 'unallocated';
dbg('connll', "Connection $call disconnected");
- unless ($^O =~ /^MS/i) {
+ unless ($main::is_win) {
kill 'TERM', $conn->{pid} if exists $conn->{pid};
}
use strict;
use vars qw(@inqueue $systime $version $starttime $lockfn @outstanding_connects
$zombies $root @listeners $lang $myalias @debug $userfn $clusteraddr
- $clusterport $mycall $decease $build
+ $clusterport $mycall $decease $build $is_win
);
@inqueue = (); # the main input queue, an array of hashes
$lockfn = "cluster.lock"; # lock file name
#@outstanding_connects = (); # list of outstanding connects
@listeners = (); # list of listeners
+$is_win = $^O =~ /^MS/ || $^O =~ /^OS-2/; # is it Windows?
+
# send a message to call on conn and disconnect
dbg('err', "load badwords: " . (BadWords::load or "Ok"));
# prime some signals
-unless ($^O =~ /^MS/) {
+unless ($is_win) {
unless ($DB::VERSION) {
$SIG{INT} = \&cease;
$SIG{TERM} = \&cease;