Subject: Re: Timeline for a new c-ares release

Re: Timeline for a new c-ares release

From: <daniel_at_poradnik-webmastera.com>
Date: Mon, 18 Jan 2016 15:02:21 +0100

Cytowanie Daniel Stenberg <daniel_at_haxx.se>:

> On Sun, 17 Jan 2016, Brad House wrote:
>
>> I also ran across this patch which may be useful when not using
>> select() or poll() to monitor the file descriptors, but rather
>> epoll() in EPOLLET mode (Edge Triggered), or using FreeBSD
>> kqueue()'s which are always edge triggered:
>> http://comments.gmane.org/gmane.network.dns.c-ares/965
>
>> I haven't yet attempted to try the patch myself, but probably will
>> in the next week or two as I'm in the process of integrating c-ares
>> into an epoll() and kqueue() event based system.
>
> It seems it needs to be rebased to apply on the current code, but I
> would love to get some feedback on how it actually performs!
>
> And an advice to anyone who wants to push for a patch to get merged
> into c-ares master: don't just throw it in here and vanish. Please
> stick around and argue for the inclusion and do remind us if we
> haven't seemed to responded to an issue for a while. We're just a
> little slow at times and if nobody seems to really want a patch,
> there's no harm in us dropping it...

Integration of epoll with c-ares is a bit problematic, because
current version misses some functionality. I did this in the past and
found that c-ares does not provide API dedicated to handle case when
epoll returns EPOLLERR for fd - such case errno should be read using
getsockopt/SO_ERROR. In such case I call ares_process_fd pretending
that socket is ready for reading, but have no idea if it would work
properly, especially if read will fail with the same errno.

I also found that c-ares does not allow to associate user pointer
with socket in socket create callback and later pass it to socket
state callback - I had to store it locally in order to properly
delete socket wrapper object when socket closes.

And last thing are problems with timer for query timeouts, c-ares
does not allow to register callback for managing this timer. I did
this by updating timer every time after calling function which
initiates/terminates query (e.q. ares_query) and after calling
ares_process_fd. This works for me. However dedicated callback
should be more efficient, e.g. it could calculate timeout faster
than ares_timeout.

-- 
Daniel
Received on 2016-01-18