X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fcluster.pl;h=d3feaa39c813c7936d72fca0abd4a1cdac6ee12a;hb=1cbfebb5c8503d55f0c03545be1f7be172376dfb;hp=20e80ddbfe16f61978b8f5731431a94c2e19375f;hpb=5b0cb88ef61ecda87a29033d8fc70edc617afc62;p=spider.git diff --git a/perl/cluster.pl b/perl/cluster.pl index 20e80ddb..d3feaa39 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -206,8 +206,10 @@ sub cease { my $dxchan; - $SIG{'TERM'} = 'IGNORE'; - $SIG{'INT'} = 'IGNORE'; + unless ($is_win) { + $SIG{'TERM'} = 'IGNORE'; + $SIG{'INT'} = 'IGNORE'; + } DXUser::sync; @@ -217,28 +219,21 @@ sub cease dbg('local', "Local::finish error $@") if $@; # disconnect nodes - foreach $dxchan (DXChannel->get_all()) { - next unless $dxchan->is_node; - $dxchan->disconnect unless $dxchan == $DXProt::me; + foreach $dxchan (DXChannel->get_all_nodes) { + $dxchan->disconnect(2) unless $dxchan == $DXProt::me; } - Msg->event_loop(1, 0.05); - Msg->event_loop(1, 0.05); + Msg->event_loop(100, 0.01); # disconnect users - foreach $dxchan (DXChannel->get_all()) { - next if $dxchan->is_node; - $dxchan->disconnect(2) unless $dxchan == $DXProt::me; + foreach $dxchan (DXChannel->get_all_users) { + $dxchan->disconnect; } # disconnect AGW AGWMsg::finish(); - - Msg->event_loop(1, 0.05); - Msg->event_loop(1, 0.05); - Msg->event_loop(1, 0.05); - Msg->event_loop(1, 0.05); - Msg->event_loop(1, 0.05); - Msg->event_loop(1, 0.05); + + # end everything else + Msg->event_loop(100, 0.01); DXUser::finish(); DXDupe::finish(); @@ -393,11 +388,11 @@ AGWrestart(); dbg('err', "load badwords: " . (BadWords::load or "Ok")); # prime some signals +unless ($DB::VERSION) { + $SIG{INT} = $SIG{TERM} = sub { $decease = 1 }; +} + unless ($is_win) { - unless ($DB::VERSION) { - $SIG{INT} = \&cease; - $SIG{TERM} = \&cease; - } $SIG{HUP} = 'IGNORE'; $SIG{CHLD} = sub { $zombies++ };