Mailing List Archive

svn commit: r439635 - /spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm
Author: jm
Date: Sat Sep 2 11:45:20 2006
New Revision: 439635

URL: http://svn.apache.org/viewvc?rev=439635&view=rev
Log:
make the really noisy ArchiveIterator debug messages conditional on explicit enabling of the 'architer' facility

Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm?rev=439635&r1=439634&r2=439635&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/ArchiveIterator.pm Sat Sep 2 11:45:20 2006
@@ -209,6 +209,8 @@

=cut

+sub aidbg;
+
sub new {
my $class = shift;
$class = ref($class) || $class;
@@ -387,7 +389,7 @@
elsif ($line =~ /^([^\0]*)\0RESULT (.+)$/s) {
my $result = $1;
my ($date,$class,$type) = index_unpack($2);
- dbg "architer: >> RESULT: $class, $type, $date\n";
+ aidbg "architer: >> RESULT: $class, $type, $date";

if (defined $self->{opt_restart} && ($total_count % $self->{opt_restart}) == 0) {
$needs_restart = 1;
@@ -397,11 +399,11 @@
if (($MESSAGES > $total_count) && !$needs_restart) {
$self->send_line($socket, $self->next_message());
$total_count++;
- dbg "architer: >> recv: $MESSAGES $total_count\n";
+ aidbg "architer: >> recv: $MESSAGES $total_count";
}
else {
# stop listening on this child since we're done with it
- dbg "architer: >> removeresult: $needs_restart $MESSAGES $total_count\n";
+ aidbg "architer: >> removeresult: $needs_restart $MESSAGES $total_count";
$select->remove($socket);
}

@@ -415,11 +417,11 @@
# we still have messages, send one to child
$self->send_line($socket, $self->next_message());
$total_count++;
- dbg "architer: >> new: $MESSAGES $total_count\n";
+ aidbg "architer: >> new: $MESSAGES $total_count";
}
else {
# no more messages, so stop listening on this child
- dbg "architer: >> removestart: $needs_restart $MESSAGES $total_count\n";
+ aidbg "architer: >> removestart: $needs_restart $MESSAGES $total_count";
$select->remove($socket);
}
}
@@ -430,7 +432,7 @@
}
}

- dbg "architer: >> out of loop, $MESSAGES $total_count $needs_restart ".$select->count()."\n";
+ aidbg "architer: >> out of loop, $MESSAGES $total_count $needs_restart ".$select->count();

# If there are still messages to process, and we need to restart
# the children, and all of the children are idle, let's go ahead.
@@ -438,7 +440,7 @@
{
$needs_restart = 0;

- dbg "architer: debug: needs restart, $MESSAGES total, $total_count done\n";
+ dbg "architer: debug: needs restart, $MESSAGES total, $total_count done";
$self->reap_children($self->{opt_j}, \@child, \@pid);
@child=();
@pid=();
@@ -614,7 +616,7 @@
select($old);

$socket->add($child->[$i]);
- dbg "architer: debug: starting new child $i (pid ".$pid->[$i].")\n";
+ dbg "architer: debug: starting new child $i (pid ".$pid->[$i].")";
next;
}
elsif (defined $pid->[$i]) {
@@ -666,7 +668,7 @@
local $SIG{'PIPE'} = 'IGNORE';

for (my $i = 0; $i < $count; $i++) {
- dbg "architer: debug: killing child $i (pid ".$pid->[$i].")\n";
+ dbg "architer: debug: killing child $i (pid ".$pid->[$i].")";
$self->send_line($socket->[$i],"exit"); # tell the child to die.
close $socket->[$i];
waitpid($pid->[$i], 0); # wait for the signal ...
@@ -683,15 +685,15 @@
my($length,$msg);

# read in the 4 byte length and unpack
- dbg "architer: << read_line\n";
+ aidbg "architer: << read_line";
sysread($fd, $length, 4);
$length = unpack("V", $length);
- dbg "architer: << $$ $length\n";
+ aidbg "architer: << $$ $length";
return unless $length;

# read in the rest of the single message
sysread($fd, $msg, $length);
- dbg "architer: << $$ $msg\n";
+ aidbg "architer: << $$ $msg";
return $msg;
}

@@ -701,7 +703,7 @@

foreach ( @_ ) {
my $length = pack("V", length $_);
- dbg "architer: >> $$ ".length($_)." $_\n";
+ aidbg "architer: >> $$ ".length($_)." $_";
syswrite($fd, $length . $_);
}
}
@@ -1236,6 +1238,12 @@
'prefix' => $self->{opt_cachedir},
'path' => $path,
});
+ }
+}
+
+sub aidbg {
+ if (would_log("architer") == 2) {
+ dbg (@_);
}
}