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

Async problems (ITS#2305)

Full_Name: Timo Sirainen
Version: 2.0.27
OS: Linux
URL: ftp://ftp.openldap.org/incoming/timo-sirainen-030208.patch
Submission from: (NULL) (

(Same as my mail to openldap-devel, which seemed to get ignored)

ldap_result() doesn't seem to behave very nicely when trying to use it
asynchronously. I call it whenever poll() says there's new data in ldap
fd, but if timeout is anything less than 1 second, it doesn't work
right. And 1 second timeout is too much since my process is doing other
things as well.

It looks like the problem is that first time when calling it,
try_read1msg() finds a reply to non-search request and returns -2
(result.c line 695). So, ldap_request() then checks if it's spent enough
time, with <1sec timeout it has and doesn't try to read the data until
later when new data comes. Then it gets a reply to previous request and
the new one is stuck..

I guess the real problem is that both of the requests are read into
buffer, but only one of them is actually handled. So, how about always
parsing the requests until valid one is found or buffer is empty?
Included patch seems to work with me.