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

RE: ldap_result() and timeval



> -----Original Message-----
> From: David Nelson [mailto:dnelson@apexvoice.com]

> Well, yes I have looked at the source for this, but not having any socket
> experience I thought time would be better served if I posted this to the
> list.  Thanks for your reply. I do have an additional question though.

(time? served? there's a good pun in there somewhere...)

> In my testing I'm doing an ldap_add() and an ldap_search().  After sending
> each request I poll with ldap_result() - with a timeout of 200ms - before
> moving on to the next request. I print a timestamp everytime ldap_result()
> returns.  The results I saw prompted my initial question.
>
> When polling for the result from ldap_add() I see the 200ms timeout
> occurring, as expected.
> When polling for the result from ldap_search(), however, I see an almost
> immediate return (10ms at most wait) each time it polls.  My search should
> return 3 entries.  "all" is set to return the entire chain of search
> entries.  I wouldn't have expected ldap_result() to return until
> the entire
> chain was ready or a timeout occurred.  But maybe it's returning after
> single entries are found - could this be the case?  If this is the case,
> what good is the "all" parameter?

Looking at the code, it certainly seems that the intent for "all" is to wait
until the entire chain is present. I'm looking at 1.2.13 by the way, I just
downloaded it since I don't use 1.2 for anything any more.

> Another interesting thing I found during testing is that if the timeval is
> set as follows {tv_sec=0, tv_usec=999000} it takes 3 polling
> attempts to get
> my result, but if it's set as {tv_sec=1, tv_usec=0} a result is obtained
> from the first ldap_result().

Sounds like the granularity of your system clock is pretty chunky. You
didn't mention what OS version and hardware you're running on.

>   -- Howard Chu
>   Chief Architect, Symas Corp.       Director, Highland Sun
>   http://www.symas.com               http://highlandsun.com/hyc
>