Enable use of select() for waiting

Hi.

I'm looking into adding DANE support to libcurl using the unbound library. Curl has an asynchronous API that supports a high number of parallel connections. Some use cases involve thousands of parallel connections to different hosts.

My understanding of https://unbound.net/documentation/libunbound-tutorial-4.html is that the libunbound asynchronous API uses a periodic polling call for each separate name lookup. This means that if we have a large number of lookups, a lot of work has to be performed just for waiting.

I would like to propose that the caller gets a file descriptor for each lookup, so he can use select() to wait on all pending lookups without having to loop through them.

Hi Bjorn,

Hi.

I'm looking into adding DANE support to libcurl using the unbound
library. Curl has an asynchronous API that supports a high number
of parallel connections. Some use cases involve thousands of
parallel connections to different hosts.

My understanding of
https://unbound.net/documentation/libunbound-tutorial-4.html is
that the libunbound asynchronous API uses a periodic polling call
for each separate name lookup. This means that if we have a large
number of lookups, a lot of work has to be performed just for
waiting.

I would like to propose that the caller gets a file descriptor for
each lookup, so he can use select() to wait on all pending lookups
without having to loop through them.

With ub_fd() you can get a file descriptor for all of the open queries
for that ub_context. And then use select() to wait on it?

If libcurl uses libevent internally, there is currently an
experimental API in svn trunk libunbound/unbound-event.h that exposes
a hook where you can get unbound to add its events to your libevent
event loop.

Best regards,
   Wouter

W.C.A. Wijngaards wrote:

With ub_fd() you can get a file descriptor for all of the open queries
for that ub_context. And then use select() to wait on it?

Ah, I had missed ub_fd(). That looks like just what I'm looking for.

Thanks!