[Mimedefang] Timeouts and message_contains_virus

David F. Skoll dfs at roaringpenguin.com
Tue Jan 26 09:16:14 EST 2010


Petra Humann wrote:

> Is it possible to set a timeout value for getting the result
> of virus scanning in message_contains_virus_sophie?

Well, not directly, but you could do something like:

eval {
     local $SIG{'ALRM'} = sub { die "Timeout\n"; };
     alarm(10);
     # Do your virus scanning
     alarm(0);
};

if ($@ && $@ =~ /Timeout/) {
   # Handle a timeout
} else {
   # Handle the normal case
}

Regards,

David.



More information about the MIMEDefang mailing list