projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed duplicate spot, always make clean ending
[spider.git]
/
perl
/
cluster.pl
diff --git
a/perl/cluster.pl
b/perl/cluster.pl
index 466da70876fd6a30f0f8bbaa46c101891cf16d3b..cc96ac59b0bf065e2bff69cdd9aa5ba0db5825fa 100755
(executable)
--- a/
perl/cluster.pl
+++ b/
perl/cluster.pl
@@
-272,10
+272,16
@@
sub login
}
# cease running this program, close down all the connections nicely
}
# cease running this program, close down all the connections nicely
+our $is_ceasing;
+
sub cease
{
my $dxchan;
sub cease
{
my $dxchan;
+ cluck("ceasing") if $is_ceasing;
+
+ return if $is_ceasing++;
+
unless ($is_win) {
$SIG{'TERM'} = 'IGNORE';
$SIG{'INT'} = 'IGNORE';
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;
}
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;
}
# disconnect users
foreach $dxchan (DXChannel::get_all_users) {
$dxchan->disconnect;
}
+ Msg->event_loop(100, 0.01);
+
# disconnect AGW
AGWMsg::finish();
BPQMsg::finish();
# disconnect AGW
AGWMsg::finish();
BPQMsg::finish();
@@
-310,8
+317,9
@@
sub cease
# end everything else
Msg->event_loop(100, 0.01);
# end everything else
Msg->event_loop(100, 0.01);
- DXUser::finish();
DXDupe::finish();
DXDupe::finish();
+ QSL::finish();
+ DXUser::finish();
# close all databases
DXDb::closeall;
# close all databases
DXDb::closeall;
@@
-321,12
+329,12
@@
sub cease
$l->close_server;
}
$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();
dbgclose();
Logclose();
- $dbh->finish if $dbh;
-
unlink $lockfn;
# $SIG{__WARN__} = $SIG{__DIE__} = sub {my $a = shift; cluck($a); };
exit(0);
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");
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 ...");
# load Prefixes
dbg("loading prefixes ...");
@@
-646,7
+655,12
@@
for (;;) {
last if --$decease <= 0;
}
}
last if --$decease <= 0;
}
}
-cease(0);
+cease(0)
unless $is_ceasing
;
exit(0);
exit(0);
+#
+sub END
+{
+ cease(0) unless $is_ceasing;
+}