summaryrefslogtreecommitdiff
path: root/Echolot
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-09-11 03:10:27 +0000
committerPeter Palfrader <peter@palfrader.org>2002-09-11 03:10:27 +0000
commitd1b1f4190ac0f55eeb08e0f676acb4d717996a06 (patch)
treede21c9084fa4139e59bf6dbae1d4002cc51edc34 /Echolot
parentd594ffd29b361bf2b964d76ddfdd7a0e1b480d12 (diff)
Add sendpings command
Diffstat (limited to 'Echolot')
-rw-r--r--Echolot/Commands.pm4
-rw-r--r--Echolot/Pinger.pm18
2 files changed, 17 insertions, 5 deletions
diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm
index 6c6901c..5efdf2d 100644
--- a/Echolot/Commands.pm
+++ b/Echolot/Commands.pm
@@ -1,7 +1,7 @@
package Echolot::Commands;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Commands.pm,v 1.10 2002/08/23 07:54:53 weasel Exp $
+# $Id: Commands.pm,v 1.11 2002/09/11 03:10:27 weasel Exp $
#
=pod
@@ -69,6 +69,8 @@ sub processCommands($) {
Echolot::Globals::get()->{'storage'}->set_stuff(@args);
} elsif ($command eq 'getkeyconf') {
Echolot::Globals::get()->{'scheduler'}->schedule('getkeyconf', 0, time(), \@args );
+ } elsif ($command eq 'sendpings') {
+ Echolot::Globals::get()->{'scheduler'}->schedule('ping', 0, time(), \@args );
} elsif ($command eq 'buildstats') {
Echolot::Globals::get()->{'scheduler'}->schedule('buildstats', 0, time() );
} elsif ($command eq 'buildkeys') {
diff --git a/Echolot/Pinger.pm b/Echolot/Pinger.pm
index b31e339..3fc7d32 100644
--- a/Echolot/Pinger.pm
+++ b/Echolot/Pinger.pm
@@ -1,7 +1,7 @@
package Echolot::Pinger;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Pinger.pm,v 1.20 2002/09/04 01:47:01 weasel Exp $
+# $Id: Pinger.pm,v 1.21 2002/09/11 03:10:27 weasel Exp $
#
=pod
@@ -84,8 +84,10 @@ sub do_ping($$$) {
return 1;
};
-sub send_pings($) {
- my ($scheduled_for) = @_;
+sub send_pings($;$) {
+ my ($scheduled_for, $which) = @_;
+
+ $which = '' unless defined $which;
my $call_intervall = Echolot::Config::get()->{'pinger_interval'};
my $send_every_n_calls = Echolot::Config::get()->{'ping_every_nth_time'};
@@ -99,11 +101,19 @@ sub send_pings($) {
next unless $remailer->{'pingit'};
my $address = $remailer->{'address'};
+ next unless (
+ $which eq 'all' ||
+ $which eq $address ||
+ $which eq '');
for my $type (Echolot::Globals::get()->{'storage'}->get_types($address)) {
next unless Echolot::Config::get()->{'do_pings'}->{$type};
for my $key (Echolot::Globals::get()->{'storage'}->get_keys($address, $type)) {
- next unless ($this_call_id eq (Echolot::Tools::makeShortNumHash($address.$type.$key.$session_id) % $send_every_n_calls));
+ next unless (
+ $which eq $address ||
+ $which eq 'all' ||
+ (($which eq '') && ($this_call_id eq (Echolot::Tools::makeShortNumHash($address.$type.$key.$session_id) % $send_every_n_calls))));
+
print "ping calling $type, $address, $key\n" if Echolot::Config::get()->{'verbose'};
do_ping($type, $address, $key);
}