On Mon, 23 Apr 2012, Brian McFarland wrote:
> It looks like I can use the "ARES_OPT_SOCK_STATE_CB" to detect when I need
> to enable/disable my watchers (i.e. event listeners) for each socket.
>
> It also appears that ares_set_socket_callback can be used to detect when
> new sockets are created and in turn initialize my libev watchers.
Yes, that's one way to do it. In libcurl we don't however and instead rely
entirely on ares_getsock().
> However, I'm not sure of the correct way to detect when sockets are closed
> so that I can safely destroy libev watchers. Is there a callback I'm
> missing that provides that information? If not, any thoughts on where to
> insert it?
The ARES_OPT_SOCK_STATE_CB callback is called on closes as well so it should
be sufficient! Unless there are bugs...
-- / daniel.haxx.seReceived on 2012-04-23