From: minima Date: Fri, 30 Mar 2001 16:45:27 +0000 (+0000) Subject: added rinit command X-Git-Tag: R_1_47~71 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=95345d68a5a8ac618021c0786c7234258b903f6e;p=spider.git added rinit command made MSWindows blocking again moved sendfile AFTER the login to the channel added generic $main::is_win flag --- diff --git a/Changes b/Changes index 166b28ea..4e511510 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ 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] diff --git a/cmd/init.pl b/cmd/init.pl index fd3c045b..b88ed013 100644 --- a/cmd/init.pl +++ b/cmd/init.pl @@ -1,5 +1,5 @@ # -# reinit a cluster connection +# init a cluster connection # # Copyright (c) 1999 Dirk Koopman G1TLH # @@ -27,7 +27,7 @@ foreach $call (@calls) { 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); diff --git a/cmd/rinit.pl b/cmd/rinit.pl new file mode 100644 index 00000000..93748ca1 --- /dev/null +++ b/cmd/rinit.pl @@ -0,0 +1,41 @@ +# +# 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); + diff --git a/perl/DXCron.pm b/perl/DXCron.pm index 1c698f75..42dbe2a5 100644 --- a/perl/DXCron.pm +++ b/perl/DXCron.pm @@ -252,7 +252,7 @@ sub spawn 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); diff --git a/perl/ExtMsg.pm b/perl/ExtMsg.pm index ae6c8a4c..d8e660b8 100644 --- a/perl/ExtMsg.pm +++ b/perl/ExtMsg.pm @@ -115,9 +115,8 @@ sub to_connected 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 { @@ -253,7 +252,7 @@ sub _doconnect *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); @@ -364,6 +363,7 @@ sub _send_file if ($f) { while (<$f>) { chomp; + dbg('connll', $_); $conn->send_raw($_ . $conn->{lineend}); } $f->close; diff --git a/perl/Msg.pm b/perl/Msg.pm index aa5edc48..3b9dbd36 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -32,8 +32,9 @@ BEGIN { 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"; @@ -195,7 +196,7 @@ sub disconnect { $call ||= 'unallocated'; dbg('connll', "Connection $call disconnected"); - unless ($^O =~ /^MS/i) { + unless ($main::is_win) { kill 'TERM', $conn->{pid} if exists $conn->{pid}; } diff --git a/perl/cluster.pl b/perl/cluster.pl index 4816916c..291a751d 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -79,7 +79,7 @@ package main; 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 @@ -89,6 +89,8 @@ $starttime = 0; # the starting time of the cluster $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 @@ -374,7 +376,7 @@ AGWMsg::init(\&new_channel); 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;