mirror of
https://github.com/MailScanner/v5.git
synced 2025-02-24 15:35:17 +08:00
Refactor scanning loop (#208)
This commit is contained in:
parent
09c0d0c2c7
commit
4aeacbb529
2 changed files with 5 additions and 11 deletions
|
@ -4,6 +4,7 @@
|
|||
- Support enable_original_recipient=no in postfix
|
||||
- Check CPANOPTION and add verbosity
|
||||
- Better AV scanning loop with retry attempts
|
||||
- Refactor AV scanning loop
|
||||
|
||||
06/17/2018 Changes in v5.0.7-4
|
||||
==================================
|
||||
|
|
|
@ -469,12 +469,10 @@ sub ScanBatch {
|
|||
chdir $BaseDir or die "Cannot chdir $BaseDir for virus scanning, $!";
|
||||
|
||||
# Dropping the message batch and trying again over and over is not good...
|
||||
# Let's make three honest attempts and then stop without further processing.
|
||||
# Another child will still spawn and try again, but this is much more sane
|
||||
# and preventions other things, such as loggers, from having repeat interactions
|
||||
# Let's remain in a loop here to suspend processing and log periodically.
|
||||
# This prevents other things, such as loggers, from having repeat interactions
|
||||
# with the same message batch indefinitely...
|
||||
my $scanstatus = 1;
|
||||
my $scanattempt = 0;
|
||||
|
||||
while($scanstatus) {
|
||||
#print STDERR (($ScanType =~ /dis/i)?"Disinfecting":"Scanning") . " using ".
|
||||
|
@ -483,16 +481,11 @@ sub ScanBatch {
|
|||
\$NumInfections, $ScanType);
|
||||
#print STDERR "Found $NumInfections infections\n";
|
||||
if ($success eq 'ScAnNeRfAiLeD') {
|
||||
$scanattempt++;
|
||||
MailScanner::Log::WarnLog("Virus Scanning: No virus scanners worked, so message batch will be tried again for attempt %s", $scanattempt);
|
||||
if ($scanattempt > 2) {
|
||||
$batch->DropBatch();
|
||||
MailScanner::Log::DieLog("Virus scanning failure, dropping batch and exiting. Fix the problem with your A/V software!");
|
||||
}
|
||||
MailScanner::Log::WarnLog("Virus Scanning: No virus scanners worked, so message batch will be tried again");
|
||||
# Delete all the messages from this batch as if we weren't scanning
|
||||
# them, and reject the batch.
|
||||
# MailScanner::Log::WarnLog("Virus Scanning: No virus scanners worked, so message batch was abandoned and retried!");
|
||||
#$batch->DropBatch();
|
||||
$batch->DropBatch();
|
||||
#return 1;
|
||||
} else {
|
||||
$scanstatus = 0;
|
||||
|
|
Loading…
Reference in a new issue