[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: How to use LDAP_OPT_CONNECT_ASYNC?



> -----Original Message-----
> From: masarati@aero.polimi.it [mailto:masarati@aero.polimi.it]
> Sent: Thursday, February 03, 2011 9:35 PM
>
> But ldap_send_initial_request() then gets a good return
> > code from ldap_open_defconn(), and so it goes on to call
> > ldap_send_server_request() to send the bind, and that then calls
> > ldap_int_poll() which waits for the connect to complete, making the
> whole operation synchronous.
>
> No. ldap_int_poll() will return -2 if timeout is 0 and the filedes was
> not
> active.  So ldap_send_server_request() will return LDAP_X_CONNECTING if
> async.

Thanks. That's what the code should be doing but it's not what I was seeing, so I did a bit of debugging and it turns out that that ldap_int_poll call returns 0, not -2. But that is because the poll (or select) call in it returns 1 indicating that the connect completed immediately. So it's actually functioning as it should.

> The only place where this is used is in back-meta, where searches
> to multiple handles were initiated sequentially, and
> LDAP_OPT_CONNECT_ASYNC was introduced to avoid having to wait for each
> connection to be established before starting processing available
> results.

That's basically exactly the exact reason I am trying to use it now.

Thanks
Ian