X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?p=spider.git;a=blobdiff_plain;f=perl%2Fcluster.pl;h=cc96ac59b0bf065e2bff69cdd9aa5ba0db5825fa;hp=466da70876fd6a30f0f8bbaa46c101891cf16d3b;hb=770092d94f96b6d22a38fb33e0056b4779a8a1ab;hpb=12f4f4b66f10e158d0ed551f619356c787468567 diff --git a/perl/cluster.pl b/perl/cluster.pl index 466da708..cc96ac59 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -272,10 +272,16 @@ sub login } # cease running this program, close down all the connections nicely +our $is_ceasing; + sub cease { my $dxchan; + cluck("ceasing") if $is_ceasing; + + return if $is_ceasing++; + unless ($is_win) { $SIG{'TERM'} = 'IGNORE'; $SIG{'INT'} = 'IGNORE'; @@ -294,13 +300,14 @@ sub cease foreach $dxchan (DXChannel::get_all_nodes) { $dxchan->disconnect(2) unless $dxchan == $main::me; } - Msg->event_loop(100, 0.01); # disconnect users foreach $dxchan (DXChannel::get_all_users) { $dxchan->disconnect; } + Msg->event_loop(100, 0.01); + # disconnect AGW AGWMsg::finish(); BPQMsg::finish(); @@ -310,8 +317,9 @@ sub cease # end everything else Msg->event_loop(100, 0.01); - DXUser::finish(); DXDupe::finish(); + QSL::finish(); + DXUser::finish(); # close all databases DXDb::closeall; @@ -321,12 +329,12 @@ sub cease $l->close_server; } - LogDbg('cluster', "DXSpider v$version build $build (git: $gitbranch/$gitversion) using perl $^V on $^O ended"); + $dbh->finish if $dbh; + + LogDbg("DXSpider v$version build $build (git: $gitbranch/$gitversion) using perl $^V on $^O ended"); dbgclose(); Logclose(); - $dbh->finish if $dbh; - unlink $lockfn; # $SIG{__WARN__} = $SIG{__DIE__} = sub {my $a = shift; cluck($a); }; exit(0); @@ -442,7 +450,8 @@ DXXml::init(); my ($year) = (gmtime)[5]; $year += 1900; LogDbg('cluster', "DXSpider v$version build $build (git: $gitbranch/$gitversion) using perl $^V on $^O started"); -dbg("Copyright (c) 1998-$year Dirk Koopman G1TLH"); +LogDbg('cluster', "Copyright (c) 1998-$year Dirk Koopman G1TLH"); +LogDbg('cluster', "Capabilities: ve7cc rbn"); # load Prefixes dbg("loading prefixes ..."); @@ -646,7 +655,12 @@ for (;;) { last if --$decease <= 0; } } -cease(0); +cease(0) unless $is_ceasing; exit(0); +# +sub END +{ + cease(0) unless $is_ceasing; +}