Oscar Figueiredo <Oscar.Figueiredo(a)di.epfl.ch> writes:
> >>>>> "William" == William M Perry <wmperry(a)aventail.com> writes:
>
> William> I think we could pretty easily do _really_ asynchronous
> searches. We can
> William> actually get the socket out of the LDAP library by using
>
> William> #ifdef HAVE_LDAP_GET_OPTION
> William> LBER_SOCKET fd;
>
> William> if (ldap_get_option(ld,LDAP_OPT_DESC,&fd) != LDAP_SUCCESS)
> William> {
> William> /* Could not get the descriptor, bail */
> William> return(-1);
> William> }
> William> #else
> William> int fd = ld->ld_sb.sb_sd;
> William> #endif
>
> William> /* Somehow add the socket to the list of fd's the event loop
> is
> William> ** waiting on. If the event loop sees the FD as getting
> data,
> William> ** go into a do { } while (1) loop calling ldap_result() with
> a
> William> ** 0-second timeout.
> William> **
> William> ** If we get a '0' back indicating a timeout, we must have
> William> ** gotten only a partial result back, and there are no more
> records to be
> William> ** read, so break out of the loop and handle the rest of the
> events.
> William> **
> William> ** Otherwise, we got a result back, call a callback function
> that
> William> ** just gets a single LDAP record, and continue through the
> loop.
> William> */
>
> William> This would be really nice, I think. We'd just have to add an
> William> 'event-stream-select-fd' that would be really close to the
> existing
> William> event-stream-select-process
>
> William> -Bill P.
>
> Sounds nice but to tell the truth I've never experienced a situation
> where I wished we had that feature so I really don't know if it's worth
> the effort given the sensitivity of the code we need to plug into. But
> if you feel it's important then definitely go for it, I am sure I will be
> happy to use it in the end.
Oh, being stud-monkey-asynchronous is really very nice. :) I would use
this for Emacs/W3 and it's ldap support. The LDAP 'asynchronous' API
really sucks and should be renamed to 'polling' - this could make it really
asynchronous.
I think being able to add an arbitrary file descriptor to the event loop
would be really useful. We could get rid of the select_process() cruft in
the event loop and just use the generic interface.
-Bill P.