I think we could pretty easily do _really_ asynchronous searches. We can
actually get the socket out of the LDAP library by using
#ifdef HAVE_LDAP_GET_OPTION
LBER_SOCKET fd;
if (ldap_get_option(ld,LDAP_OPT_DESC,&fd) != LDAP_SUCCESS)
{
/* Could not get the descriptor, bail */
return(-1);
}
#else
int fd = ld->ld_sb.sb_sd;
#endif
/* Somehow add the socket to the list of fd's the event loop is
** waiting on. If the event loop sees the FD as getting data,
** go into a do { } while (1) loop calling ldap_result() with a
** 0-second timeout.
**
** If we get a '0' back indicating a timeout, we must have
** gotten only a partial result back, and there are no more records to be
** read, so break out of the loop and handle the rest of the events.
**
** Otherwise, we got a result back, call a callback function that
** just gets a single LDAP record, and continue through the loop.
*/
This would be really nice, I think. We'd just have to add an
'event-stream-select-fd' that would be really close to the existing
event-stream-select-process
-Bill P.
Show replies by date