in reply to Windows: AnyEvent -> HTTP -> DNS - > Blocking for minutes
means I can't redefine the _defaults function, as it gets re-defined each time AnyEvent::DNS calls it.
Can you explain that? From what I see in AnyEvent::DNS, it is only using Net::DNS::Resolve here:
and $r goes out of scope after that. There should not be any problem monkey-patching functions inside of Net::DNS::Resolver, or even AnyEvent::DNS. But you don't need to monkey-patch it if you know your resolvers, because:require Net::DNS::Resolver; my $r = Net::DNS::Resolver->new; $r->nameservers or die; for my $s ($r->nameservers) { if (my $ipn = AnyEvent::Socket::parse_address ($s)) { push @{ $self->{server} }, $ipn; } } $self->{search} = [$r->searchlist];
So it appears you have lots of options to customize this.AnyEvent::DNS::resolver This function creates and returns a resolver that is ready to use and should mimic the default resolver for your system as good as possible. It is used by AnyEvent itself as well. It only ever creates one resolver and returns this one on subsequent calls - see $AnyEvent::DNS::RESOLVER, below, for details. Unless you have special needs, prefer this function over creating your own resolver object. The resolver is created with the following parameters: untaint enabled max_outstanding $ENV{PERL_ANYEVENT_MAX_OUTSTANDING_DNS} (default 10) os_config will be used for OS-specific configuration, unless $ENV{PERL_ANYEVENT_RESOLV_CONF} is specified, in which case that file gets parsed. $AnyEvent::DNS::RESOLVER This variable stores the default resolver returned by AnyEvent::DNS::resolver, or undef when the default resolver hasn't been instantiated yet. One can provide a custom resolver (e.g. one with caching functionality) by storing it in this variable, causing all subsequent resolves done via AnyEvent::DNS::resolver to be done via the custom one.
Meanwhile, AnyEvent::DNS doesn't use Net::DNS::Resolver for DNS lookups, it only uses it to dig the nameserver list and search path out of the Windows registry. Are you sure that your program is hanging in the place that you think it's hanging?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Windows: AnyEvent -> HTTP -> DNS - > Blocking for minutes
by sectokia (Friar) on Oct 19, 2022 at 09:28 UTC | |
by NERDVANA (Priest) on Oct 20, 2022 at 02:36 UTC | |
by hippo (Archbishop) on Oct 20, 2022 at 08:43 UTC | |
by sectokia (Friar) on Oct 20, 2022 at 04:26 UTC | |
by NERDVANA (Priest) on Oct 20, 2022 at 23:12 UTC | |
by sectokia (Friar) on Oct 21, 2022 at 01:13 UTC |