Subject: | nameserver is only set in constructor |
Description:
Different "nameservers" options for different queries are not honored
because the nameserver option is set in the Resolver.pm constructor.
Steps to reproduce:
ParaDNS->new(
callback => sub { print "Got result: $_[0]\n" },
host => 'google.com',
nameserver => '8.8.8.8'
);
ParaDNS->new(
callback => sub { print "Got result: $_[0]\n" },
host => 'google.com',
nameserver => '8.8.4.4'
);
Actual result:
The script will send two queries to 8.8.8.8.
Expected result:
The script will send one query 8.8.8.8 and one to 8.8.4.4.
Fix:
I was able to fix this for my application by creating a new resolver for
each request, but that's pretty suboptimal...
ParaDNS.pm
58c58
< $RESOLVER{$$} ||= ParaDNS::Resolver->new($servers);
---
Show quoted text
> $RESOLVER{$$} = ParaDNS::Resolver->new($servers);
A real solution(tm) might be harder to come up with. I tried putting the
nameserver setup outside of the Resolver.pm constructor but that didn't
work out because of the way it asynchronously works (I guess)...