Finally a working version :-/

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@580 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2005-11-22 23:43:08 +00:00
parent dfe9dda454
commit 8f7882d076

View File

@ -34,6 +34,7 @@ sub connect_handler {
my $reversed_ip = join(".", reverse(split(/\./, $remote_ip))); my $reversed_ip = join(".", reverse(split(/\./, $remote_ip)));
my $total_zones = keys %dnsbl_zones;
my $qp = $self->qp; my $qp = $self->qp;
for my $dnsbl (keys %dnsbl_zones) { for my $dnsbl (keys %dnsbl_zones) {
# fix to find A records, if the dnsbl_zones line has a second field 20/1/04 ++msp # fix to find A records, if the dnsbl_zones line has a second field 20/1/04 ++msp
@ -41,7 +42,7 @@ sub connect_handler {
$self->log(LOGDEBUG, "Checking $reversed_ip.$dnsbl for A record in the background"); $self->log(LOGDEBUG, "Checking $reversed_ip.$dnsbl for A record in the background");
Danga::DNS->new( Danga::DNS->new(
callback => sub { process_a_result($qp, $dnsbl_zones{$dnsbl}, @_) }, callback => sub { process_a_result($qp, $dnsbl_zones{$dnsbl}, @_) },
finished => sub { finished($qp) }, finished => sub { $total_zones--; finished($qp, $total_zones) },
host => "$reversed_ip.$dnsbl", host => "$reversed_ip.$dnsbl",
type => 'A', type => 'A',
client => $self->qp->input_sock, client => $self->qp->input_sock,
@ -50,7 +51,7 @@ sub connect_handler {
$self->log(LOGDEBUG, "Checking $reversed_ip.$dnsbl for TXT record in the background"); $self->log(LOGDEBUG, "Checking $reversed_ip.$dnsbl for TXT record in the background");
Danga::DNS->new( Danga::DNS->new(
callback => sub { process_txt_result($qp, @_) }, callback => sub { process_txt_result($qp, @_) },
finished => sub { finished($qp) }, finished => sub { $total_zones--; finished($qp, $total_zones) },
host => "$reversed_ip.$dnsbl", host => "$reversed_ip.$dnsbl",
type => 'TXT', type => 'TXT',
client => $self->qp->input_sock, client => $self->qp->input_sock,
@ -62,8 +63,8 @@ sub connect_handler {
} }
sub finished { sub finished {
my ($qp) = @_; my ($qp, $total_zones) = @_;
$qp->finish_continuation; $qp->finish_continuation unless $total_zones;
} }
sub process_a_result { sub process_a_result {