Proposal for actory method for DNS resolvers
Marc Lehmann
schmorp at schmorp.de
Wed Feb 9 02:35:27 CET 2011
On Tue, Feb 08, 2011 at 09:12:42PM +0100, Emmanuel Rodriguez <emmanuel.rodriguez at gmail.com> wrote:
> I implemented a very simple DNS cache for AnyEvent [1] and I have some
> troubles creating an original DNS instance the same way as
> AnyEvent::DNS does.
Hi!
> It would greatly help me if the code of AnyDNS::resolver() would be
> split in two:
> - the resolver singleton call
(which already exists)
> - the construction of an instance (factory method)
What usecase would it have? You can just call new on your own resolver
class right now, if you want to create a new one, while AnyEvent itself
never uses more than one (by design).
> I create the RT ticket 65250 [2]that proposes a patch but I have a
> feeling that RT is not being looked at.
Actually, you got a response there, so it's more like you didn't read the
reply for some reason? :)
> Since I mentioned RT, there's also there another patch that fixes a
> bug with weak references that can get undef in the main resolver
> instance is destroyed before the callback is called [3].
> [3] https://rt.cpan.org/Public/Bug/Display.html?id=65251
I've looked at it, but the patch doesn't fix anything. Can you make a
testcase that triggers this issue?
The reason it doesn't fix this is that the only reference to the watcher
is stored in %$wself, so if $wself is undef then the watcher reference
doesn't exist either, and there is a bug somewhere else that calls the
watcher even though it has been destroyed.
If this happened only with POE, then this might have been due to a bug in
POE that caused exactly this behaviour (which is worked around in AnyEvent
5.31).
Greetings,
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the anyevent
mailing list