[Mimedefang] Timeout on md_check_against_smtp_server?

Dave Osbourne dave at osbourne.uk.eu.org
Mon Aug 17 06:13:47 EDT 2015


Dianne,

Thank you very much for this!

Changes effected and tested over the w/end and all seems OK.  I'd never 
thought to do this if it weren't for that little prod.

Regards,
Dave

On 15/08/2015 15:42, Dianne Skoll wrote:
> On Sat, 15 Aug 2015 12:39:04 +0100
> Dave Osbourne <dave at osbourne.uk.eu.org> wrote:
>
>> I wonder if there is away to enforce a timeout on
>> md_check_against_smtp_server?
> The general-purpose way of enforcing timeouts is with alarm.
>
> {
>      local $SIG{ALRM} = sub { die "Timeout"; };
>      my @result;
>      eval {
>      	 alarm(60); # Or whatever timeout you want
> 	 @result = md_check_against_smtp_server(...);
> 	 alarm(0);
>      };
>      if ($@ && $@ =~ /Timeout/) {
>          # Handle timeout
>      } else {
>          # Handle @result
>      }
> }
>
> Regards,
>
> Dianne.
> _______________________________________________
> NOTE: If there is a disclaimer or other legal boilerplate in the above
> message, it is NULL AND VOID.  You may ignore it.
>
> Visit http://www.mimedefang.org and http://www.roaringpenguin.com
> MIMEDefang mailing list MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang




More information about the MIMEDefang mailing list