Skip to content

Commit

Permalink
Build the default resolver as AnyEvent::DNS::resolver() does
Browse files Browse the repository at this point in the history
  • Loading branch information
potyl committed Feb 2, 2011
1 parent 8816304 commit 6fa7221
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/AnyEvent/CacheDNS.pm
Expand Up @@ -53,7 +53,25 @@ sub resolve {

sub register {
my $class = shift;
$AnyEvent::DNS::RESOLVER = $class->new();

my @args = (
untaint => 1,
);

my $key = 'PERL_ANYEVENT_MAX_OUTSTANDING_DNS';
push @args, max_outstanding => $ENV{$key} * 1 || 1 if exists $ENV{$key};

my $resolver = $class->new(@args);

if (exists $ENV{PERL_ANYEVENT_RESOLV_CONF}) {
my $conf = $ENV{PERL_ANYEVENT_RESOLV_CONF};
$resolver->_parse_resolv_conf_file($conf) if length $conf;
}
else {
$resolver->os_config();
}

$AnyEvent::DNS::RESOLVER = $resolver;
}


Expand Down

0 comments on commit 6fa7221

Please sign in to comment.