You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by do...@apache.org on 2007/09/20 10:23:38 UTC
svn commit: r577625 - /spamassassin/trunk/masses/mass-check
Author: dos
Date: Thu Sep 20 01:23:38 2007
New Revision: 577625
URL: http://svn.apache.org/viewvc?rev=577625&view=rev
Log:
handle message errors on the server (by skipping the message and still supplying the client with the number of messages we told them we would) when not running in --cs_paths_only mode; missing messages in --cs_paths_only mode will still fsck things up royally (clients and server will loop retrying the missing messages); the retry portion of the code I committed and then reverted last week will probably fix this fine; will look at later
Modified:
spamassassin/trunk/masses/mass-check
Modified: spamassassin/trunk/masses/mass-check
URL: http://svn.apache.org/viewvc/spamassassin/trunk/masses/mass-check?rev=577625&r1=577624&r2=577625&view=diff
==============================================================================
--- spamassassin/trunk/masses/mass-check (original)
+++ spamassassin/trunk/masses/mass-check Thu Sep 20 01:23:38 2007
@@ -1102,6 +1102,7 @@
# Hold the message numbers we'll be sending out
my @tosend = ();
+ my @sent = ();
# Find out if any of the messages we sent out before need to be sent out
# again because we haven't seen a response within the timeout.
@@ -1171,15 +1172,33 @@
# 1- server message number in text format
# 2- server index string, binary packed format
# 3- message content -- unless paths_only
- send_line($gzfd, $num) || die "mass-check: error when writing to gz temp file\n";
-
my $data = $msgsout->{$num}->{'data'};
- send_line($gzfd, $data) || die "mass-check: error when writing to gz temp file\n";
-
if (!$paths_only) {
my $msg = ($iter->_run_message($data))[4];
- send_line($gzfd, join('', @{$msg})) ||
- die "mass-check: error when writing to gz temp file\n";
+ if ($msg) {
+ send_line($gzfd, $num) || die "mass-check: error when writing to gz temp file\n";
+ send_line($gzfd, $data) || die "mass-check: error when writing to gz temp file\n";
+ send_line($gzfd, join('', @{$msg})) ||
+ die "mass-check: error when writing to gz temp file\n";
+ push @sent, $num;
+ } else {
+ # if the message has an error (probably due to it being removed sometime during the
+ # run) we need to send a blank message (that we'll ignore the results for due to the
+ # bogus message number (0) in its place since we have already added the line telling
+ # the client how many messages to expect
+ # NOTE: for some reason the client doesn't seem to even scan these messages (which is
+ # fine)... if it were to it probably wouldn't be great for bayes enabled mass-checks
+ send_line($gzfd, 0) || die "mass-check: error when writing to gz temp file\n";
+ send_line($gzfd, 'msg-error') || die "mass-check: error when writing to gz temp file\n";
+ send_line($gzfd, 'empty-message-will-cause-client-to-hang') ||
+ die "mass-check: error when writing to gz temp file\n";
+ delete $msgsout->{$num};
+ }
+ } else {
+ send_line($gzfd, $num) || die "mass-check: error when writing to gz temp file\n";
+ send_line($gzfd, $data) || die "mass-check: error when writing to gz temp file\n";
+ # the client deals with missing messages on its own (sort of)
+ push @sent, $num;
}
}
@@ -1187,16 +1206,16 @@
# update timestamp entries
my $ts = time;
- foreach (@tosend) {
+ foreach (@sent) {
$msgsout->{$_}->{'timestamp'} = $ts;
}
# conveniently, this list should be the only thing sent out w/ this
# timestamp, so just set the reference appropriately. :)
- $timestamps->{$ts} = \@tosend;
+ $timestamps->{$ts} = \@sent;
if ($opt_noisy) {
- print "generated ".scalar(@tosend)." messages\n";
+ print "generated ".scalar(@sent)." messages from initial ".scalar(@tosend)." messages\n";
}
return $gzpath;