Nick Mathewson wrote:
> On Tue, Oct 02, 2007 at 09:35:48AM +0200, Robert Iakobashvili wrote:
>  [...]
>> libcurl has developed a good API for its integration with libevent.
>> libcurl project also maintains and develops a very good asynchronous DNS
>> client library, called c-ares (a clone of ares).
>>
>> Could it be a better path to concentrate the community efforts on
>> integration of c-ares and libcurl with libevent and to assist better
>> to applications?
> 
> I would love somebody to get c-ares working right with libevent.  I
> don't think this is a matter of "concentrating the community efforts",
> however: I think it's a matter of somebody stepping up to contribute
> the right patch to c-ares.
> 
> The last time I checked, the main problems preventing c-ares from
> working optimally with libevent were:
>   o C-ares had functions to fetch a list of sockets that needed
>     to be read and written, but no way to make a callback happen when
>     that list changes.  This is fine for select() and poll(), but
>     Libevent, on the other hand, wants to be told about _changes_ in
>     socket state via event_add and event_del.
> 
>     Fixing this is probably a matter of adding a callback facility to
>     c-ares.

It already exists:

    struct ares_options options;

    ...
    options.sock_state_cb = foo;
    ...
    ... = ares_init_options(..., &options, ...|ARES_OPT_SOCK_STATE_CB);

>   o The only way to tell c-ares about readable/writable sockets was
>     via a function, ares_process(), that took an fd_set.  This is
>     suboptimal because 1) Libevent wants to alert applications about
>     one socket at a time, and 2) Libevent is designed for situations
>     where there are thousands of sockets, and making an fd_set with
>     thousands of elements gives awful performance.
> 
>     Fixing this is probably a matter of adding an alternate way to
>     invoke functionality of ares_process().

Also exists:

void ares_process_fd(ares_channel channel, ares_socket_t read_fd,
                     ares_socket_t write_fd);

> 
> Of course, stuff may have changed since then; these problems may be
> solved.

Yup.

> 
> (I, _personally_, don't think I could use c-ares for my needs, since I
> need DNS server support as well as client support, and I'm under the
> impression that c-ares only provides the latter.  But the more
> libraries that support libevent, the better.)
> 
> yrs,
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Libevent-users mailing list
> Libevent-users@monkey.org
> http://monkey.org/mailman/listinfo/libevent-users

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to