);
-$clusteraddr //= '127.0.0.1'; # cluster tcp host address - used for things like console.pl
-$clusterport //= 27754; # cluster tcp port
+$clusteraddr ||= '127.0.0.1'; # cluster tcp host address - used for things like console.pl
+$clusterport ||= 27754; # cluster tcp port
@inqueue = (); # the main input queue, an array of hashes
$systime = 0; # the time now (in seconds)
$starttime = 0; # the starting time of the cluster
}
# 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';
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();
# end everything else
Msg->event_loop(100, 0.01);
- DXUser::finish();
DXDupe::finish();
+ QSL::finish();
+ DXUser::finish();
# close all databases
DXDb::closeall;
$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);
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 ...");
last if --$decease <= 0;
}
}
-cease(0);
+cease(0) unless $is_ceasing;
exit(0);
+#
+sub END
+{
+ cease(0) unless $is_ceasing;
+}