Unverified Commit ccc50085 authored by Gavin Brown's avatar Gavin Brown
Browse files

instantiate and configure the resolver object in a single shot

parent beae6dd4
......@@ -236,26 +236,26 @@ sub main_loop {
sub time_query {
my ($family, $proto, @servers) = @_;
return undef if (scalar(@servers) < 1);
#
# construct and configure a new resolver object
#
my $resolver = Net::DNS::Resolver->new;
$resolver->retry(0);
$resolver->igntc(1);
$resolver->usevc('tcp' eq $proto);
$resolver->udp_timeout($CONF->{'Timeout'});
$resolver->tcp_timeout($CONF->{'Timeout'});
$resolver->persistent_udp(0);
$resolver->persistent_tcp(0);
$resolver->force_v4(4 == $family);
$resolver->force_v6(6 == $family);
if (scalar(@servers) < 1) {
warn('received an empty set of nameservers');
return undef;
} else {
#
# specify nameservers
#
$resolver->nameservers(@servers);
# construct a resolver
#
my $resolver = Net::DNS::Resolver->new(
'nameservers' => \@servers,
'retry' => 0,
'igntc' => 1,
'usevc' => ('tcp' eq $proto),
'udp_timeout' => $CONF->{'Timeout'},
'tcp_timeout' => $CONF->{'Timeout'},
'persistent_udp' => 0,
'persistent_tcp' => 0,
'force_v4' => 4 == $family,
'force_v6' => 6 == $family,
);
my $result;
......@@ -282,6 +282,7 @@ sub time_query {
return $dt;
}
}
}
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment