From 70ac732dbf0595f3df5e967db594dbc35a357dcc Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Fri, 21 Feb 2003 06:37:52 +0000 Subject: Add sendchainpings command --- pingd | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'pingd') diff --git a/pingd b/pingd index 2d6977c..a31fc69 100755 --- a/pingd +++ b/pingd @@ -3,7 +3,7 @@ $| = 1; # (c) 2002, 2003 Peter Palfrader -# $Id: pingd,v 1.100 2003/02/20 19:39:03 weasel Exp $ +# $Id: pingd,v 1.101 2003/02/21 06:37:52 weasel Exp $ # =pod @@ -36,6 +36,8 @@ pingd - echolot ping daemon =item B B [I
[I
...]] +=item B B I
B<:>I
[I
B<:>I
...] + =item B B =item B B @@ -44,6 +46,8 @@ pingd - echolot ping daemon =item B B +=item B B + =item B B =back @@ -140,6 +144,11 @@ If no addresses are given requests will be sent to all remailers. Send a command to immediatly send pings to the given remailers. If no addresses are given requests will be sent to all remailers. +=item B I
B<:>I
[I
B<:>I
...] + +Send a command to immediatly send chain pings to the given chains. +A chain is two remailer addresses seperated by a colon. + =item B Send a command to immediatly rebuild stats. @@ -194,8 +203,9 @@ Print version number and exit sucessfully. =item B<--nohup> Usefull only with the B, B, B, -B, B, B, B, -B, B, B or B command. +B, B, B, B, +B, B, B, B, +or B command. Don't send a HUP signal to the daemon which instructs it to process the commands after adding the command to the task list. @@ -456,6 +466,23 @@ sub command_sendpings(@) { }; }; +sub command_sendchainpings(@) { + my @argv = @_; + + my @args; + for my $arg (@argv) { + my ($addr1, $addr2) = split /:/, $arg; + die ("Argument $arg is not in the form address1:address2") unless defined $addr1 && defined $addr2; + die ("Address 1 in $arg ('$addr1') is not a valid email address\n") unless ($addr1 =~ /^[a-zA-Z0-9+._-]+\@[a-zA-Z0-9+.-]+$/ ); + die ("Address 2 in $arg ('$addr2') is not a valid email address\n") unless ($addr2 =~ /^[a-zA-Z0-9+._-]+\@[a-zA-Z0-9+.-]+$/ ); + push @args, [ $addr1, $addr2 ]; + }; + + for my $arg (@args) { + Echolot::Commands::addCommand("sendchainpings $arg->[0] $arg->[1]"); + }; +}; + sub pid_exists($) { my ($remove_stale) = @_; @@ -651,6 +678,7 @@ if ($params->{'help'}) { print (" deleteremailercaps ... delete remailer capabilities manually\n"); print (" getkeyconf ... request remailer-xxx data immediatly\n"); print (" sendpings ... request immediate sending of pings\n"); + print (" sendchainpings ... request immediate sending of chainpings\n"); print (" buildstats ... build remailer stats immediatly\n"); print (" buildkeys ... buid keyrings immediatly\n"); print (" buildthesaurus ... build thesaurus immediatly\n"); @@ -694,6 +722,9 @@ if ($COMMAND eq 'add' || $COMMAND eq 'delete') { } elsif ($COMMAND eq 'sendpings') { command_sendpings(@ARGV); hup_if_wanted($params->{'nohup'}); +} elsif ($COMMAND eq 'sendchainpings') { + command_sendchainpings(@ARGV); + hup_if_wanted($params->{'nohup'}); } elsif ($COMMAND eq 'buildstats') { Echolot::Commands::addCommand("buildstats"); hup_if_wanted($params->{'nohup'}); -- cgit v1.2.3