You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/06/14 20:17:29 UTC
svn commit: r547344 - /spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm
Author: jm
Date: Thu Jun 14 11:17:28 2007
New Revision: 547344
URL: http://svn.apache.org/viewvc?view=rev&rev=547344
Log:
bug 5511: recompute the DNS lookup deadline after every call to {async}->complete_lookups(), to avoid timing out too early; also, never allow the deadline to be recomputed to 0 in contradiction of the documentation. thanks to Mark Martinec
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm?view=diff&rev=547344&r1=547343&r2=547344
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm Thu Jun 14 11:17:28 2007
@@ -345,9 +345,13 @@
$self->{main}->call_plugins ("check_tick", { permsgstatus => $self });
@left = $self->{async}->get_pending_lookups();
+ # complete_lookups could cause a change in get_last_start_lookup_time
+ $deadline = $self->{conf}->{rbl_timeout} +
+ $self->{async}->get_last_start_lookup_time();
+
# dynamic timeout
my $dynamic = (int($self->{conf}->{rbl_timeout}
- * (1 - (($total - scalar @left) / $total) ** 2) + 0.5)
+ * (1 - 0.7*(($total - @left) / $total) ** 2) + 1)
+ $self->{async}->get_last_start_lookup_time());
$deadline = $dynamic if ($dynamic < $deadline);
$now = time;
@@ -370,9 +374,15 @@
$self->{main}->call_plugins ("check_tick", { permsgstatus => $self });
@left = $self->{async}->get_pending_lookups();
+ # complete_lookups() may have called completed_callback, which may call
+ # start_lookup() again (like in URIDNSBL), so get_last_start_lookup_time
+ # may have changed and deadline needs to be recomputed
+ $deadline = $self->{conf}->{rbl_timeout} +
+ $self->{async}->get_last_start_lookup_time();
+
# dynamic timeout
my $dynamic = (int($self->{conf}->{rbl_timeout}
- * (1 - (($total - scalar @left) / $total) ** 2) + 0.5)
+ * (1 - 0.7*(($total - @left) / $total) ** 2) + 1)
+ $self->{async}->get_last_start_lookup_time());
$deadline = $dynamic if ($dynamic < $deadline);
$now = time; # and loop again