From a21e00e8907f6c21399ef797f9490c9402c56c7f Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 22 Jul 2002 01:28:21 +0000 Subject: Not the current time but the scheduled start time is used when deciding which remailers to ping --- Echolot/Conf.pm | 8 ++++---- Echolot/Pinger.pm | 8 +++++--- Echolot/Scheduler.pm | 4 ++-- NEWS | 3 +++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Echolot/Conf.pm b/Echolot/Conf.pm index 3e73a68..9242045 100644 --- a/Echolot/Conf.pm +++ b/Echolot/Conf.pm @@ -1,7 +1,7 @@ package Echolot::Conf; # (c) 2002 Peter Palfrader -# $Id: Conf.pm,v 1.21 2002/07/17 19:00:22 weasel Exp $ +# $Id: Conf.pm,v 1.22 2002/07/22 01:28:21 weasel Exp $ # =pod @@ -37,15 +37,15 @@ sub is_not_a_remailer($) { }; }; -sub send_requests(;$) { - my ($which) = @_; +sub send_requests($;$) { + my ($scheduled_for, $which) = @_; $which = '' unless defined $which; my $call_intervall = Echolot::Config::get()->{'getkeyconf_interval'}; my $send_every_n_calls = Echolot::Config::get()->{'getkeyconf_every_nth_time'}; - my $timemod = (time() / $call_intervall); + my $timemod = ($scheduled_for / $call_intervall); my $this_call_id = $timemod % $send_every_n_calls; Echolot::Globals::get()->{'storage'}->delay_commit(); diff --git a/Echolot/Pinger.pm b/Echolot/Pinger.pm index 2ddf571..a9a89af 100644 --- a/Echolot/Pinger.pm +++ b/Echolot/Pinger.pm @@ -1,7 +1,7 @@ package Echolot::Pinger; # (c) 2002 Peter Palfrader -# $Id: Pinger.pm,v 1.17 2002/07/17 17:53:44 weasel Exp $ +# $Id: Pinger.pm,v 1.18 2002/07/22 01:28:21 weasel Exp $ # =pod @@ -83,11 +83,13 @@ sub do_ping($$$) { return 1; }; -sub send_pings() { +sub send_pings($) { + my ($scheduled_for) = @_; + my $call_intervall = Echolot::Config::get()->{'pinger_interval'}; my $send_every_n_calls = Echolot::Config::get()->{'ping_every_nth_time'}; - my $timemod = (time() / $call_intervall); + my $timemod = ($scheduled_for / $call_intervall); my $this_call_id = $timemod % $send_every_n_calls; my @remailers = Echolot::Globals::get()->{'storage'}->get_remailers(); diff --git a/Echolot/Scheduler.pm b/Echolot/Scheduler.pm index c122769..df245c8 100644 --- a/Echolot/Scheduler.pm +++ b/Echolot/Scheduler.pm @@ -1,7 +1,7 @@ package Echolot::Scheduler; # (c) 2002 Peter Palfrader -# $Id: Scheduler.pm,v 1.10 2002/07/17 17:53:44 weasel Exp $ +# $Id: Scheduler.pm,v 1.11 2002/07/22 01:28:21 weasel Exp $ # =pod @@ -145,7 +145,7 @@ sub run($) { my $what = $self->{'tasks'}->{$name}->{'what'}; print "Running $name at ".(time())." (scheduled for $now)\n" if Echolot::Config::get()->{'verbose'}; last if ($what eq 'exit'); - &$what( @{ $task->{'arguments'} } ); + &$what( $now, @{ $task->{'arguments'} } ); $self->schedule($name, $now + $self->{'tasks'}->{$name}->{'interval'}) if ($self->{'tasks'}->{$name}->{'interval'} > 0); diff --git a/NEWS b/NEWS index 563a64d..8adb9b0 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,7 @@ Changes in version + * Not the current time but the scheduled start time is used when + deciding which remailers to ping. This is nice if we get delayed for + whatever reason. * Changed URL in templates to point to www.palfrader.org/echolot instead of the savannah page. -- cgit v1.2.3