From a88423686da4cac657f06e3e138f22416d951325 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 16 Feb 2003 03:38:09 +0000 Subject: Minor fixes re chain pinging --- Echolot/Conf.pm | 6 +++--- Echolot/Config.pm | 7 ++++--- Echolot/Stats.pm | 25 +++++++++++++------------ 3 files changed, 20 insertions(+), 18 deletions(-) (limited to 'Echolot') diff --git a/Echolot/Conf.pm b/Echolot/Conf.pm index 82ceff0..d5b9505 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.36 2003/01/14 06:56:22 weasel Exp $ +# $Id: Conf.pm,v 1.37 2003/02/16 03:38:09 weasel Exp $ # =pod @@ -68,7 +68,7 @@ sub send_requests($;$) { $which eq 'all' || (($which eq '') && ($this_call_id == (Echolot::Tools::makeShortNumHash($address.$type.$session_id) % $send_every_n_calls)))); - Echolot::Log::info("Sending $type request to ".$address."."); + Echolot::Log::debug("Sending $type request to ".$address."."); my $source_text = Echolot::Config::get()->{'remailerxxxtext'}; my $template = HTML::Template->new( @@ -97,7 +97,7 @@ sub check_resurrection() { next unless ($remailer->{'status'} eq 'ttl timeout'); next unless ($remailer->{'fetch'}); next unless ($remailer->{'resurrection_ttl'}); - Echolot::Log::info("Sending request to ".$remailer->{'address'}." to check for resurrection."); + Echolot::Log::debug("Sending request to ".$remailer->{'address'}." to check for resurrection."); for my $type (qw{conf key help stats adminkey}) { Echolot::Tools::send_message( 'To' => $remailer->{'address'}, diff --git a/Echolot/Config.pm b/Echolot/Config.pm index db20904..f0f3c12 100644 --- a/Echolot/Config.pm +++ b/Echolot/Config.pm @@ -1,7 +1,7 @@ package Echolot::Config; # (c) 2002 Peter Palfrader -# $Id: Config.pm,v 1.50 2003/02/16 03:06:51 weasel Exp $ +# $Id: Config.pm,v 1.51 2003/02/16 03:38:09 weasel Exp $ # =pod @@ -101,10 +101,10 @@ sub init($) { chainpinger_interval => 5*60, # send out pings every 5 minutes chainping_every_nth_time => 810, # send out pings to the same chain every 810 calls, i.e. every 3 days - chainping_period => 10*24*60*60, # 10 days + chainping_period => 10*24*60*60, # 12 days chainping_fudge => 0.7, # if less than 0.7 * rel1 * rel2 make it, the chain is really broken chainping_grace => 1.5, # don't count pings sent no longer than 1.5 * (lat1 + lat2) ago - chainping_update => 300, # chain stats should never be older than 300 seconds + chainping_update => 8*60*60, # chain stats should never be older than 8 hours addresses_default_ttl => 5, # getkeyconf seconds (days) check_resurrection_ttl => 8, # check_resurrection seconds (weeks) @@ -115,6 +115,7 @@ sub init($) { expire_confs => 5*24*60*60, # 5 days expire_pings => 12*24*60*60, # 12 days expire_thesaurus => 21*24*60*60, # 21 days + expire_chainpings => 12*24*60*60, # 12 days # Directories and files mailin => 'mail', diff --git a/Echolot/Stats.pm b/Echolot/Stats.pm index c3a21b4..b6e0ea3 100644 --- a/Echolot/Stats.pm +++ b/Echolot/Stats.pm @@ -1,7 +1,7 @@ package Echolot::Stats; # (c) 2002 Peter Palfrader -# $Id: Stats.pm,v 1.40 2003/02/16 03:06:51 weasel Exp $ +# $Id: Stats.pm,v 1.41 2003/02/16 03:38:09 weasel Exp $ # =pod @@ -507,8 +507,11 @@ sub find_broken_chains($$$) { $received{$addr1.':'.$addr2.':'.$sent} = 1; }; if ($status_out && !defined $received{$addr1.':'.$addr2.':'.$sent}) { - my $theoretical_lat = $remailers{$addr1}->{'stats'}->{'avr_latency'} + - $remailers{$addr2}->{'stats'}->{'avr_latency'}; + my $lat1 = $remailers{$addr1}->{'stats'}->{'avr_latency'}; + my $lat2 = $remailers{$addr2}->{'stats'}->{'avr_latency'}; + $lat1 = 0 unless defined $lat1; + $lat2 = 0 unless defined $lat2; + my $theoretical_lat = $lat1 + $lat2; $theoretical_lat = 0 unless defined $theoretical_lat; my $latency = time() - $ping->{'sent'}; # print ("lat helps $latency $theoretical_lat\n"), @@ -525,16 +528,14 @@ sub find_broken_chains($$$) { for my $addr2 (keys %{$stats->{$addr1}}) { my $theoretical_rel = $remailers{$addr1}->{'stats'}->{'avr_reliability'} * $remailers{$addr2}->{'stats'}->{'avr_reliability'}; - ($stats->{$addr1}->{$addr2}->{'out'} != 0) or - Echolot::Log::debug("Should not devide through zero (". - $stats->{$addr1}->{$addr2}->{'done'}."/". - $stats->{$addr1}->{$addr2}->{'out'}. - ") for $addr1, $addr2."), + my $out = $stats->{$addr1}->{$addr2}->{'out'}; + my $done = $stats->{$addr1}->{$addr2}->{'done'}; + $done = 0 unless defined $done; + ($out > 0) or + Echolot::Log::debug("Should not devide through zero ($done/$out) for $addr1, $addr2."), next; - my $real_rel = $stats->{$addr1}->{$addr2}->{'done'} / - $stats->{$addr1}->{$addr2}->{'out'}; - # print "$addr1 $addr2 $stats->{$addr1}->{$addr2}->{'done'}/$stats->{$addr1}->{$addr2}->{'out'}". - # " == $real_rel ($theoretical_rel)\n"; + my $real_rel = $done / $out; + # print "$addr1 $addr2 $done / $out == $real_rel ($theoretical_rel)\n"; next if ($real_rel > $theoretical_rel * Echolot::Config::get()->{'chainping_fudge'}); my $nick1 = $remailers{$addr1}->{'nick'}; my $nick2 = $remailers{$addr2}->{'nick'}; -- cgit v1.2.3