From: Michael <mi...@st...> - 2001-04-17 17:49:35
|
HI! I wrote a drop-in replacement class for LDAPObject for locking calls into the LDAP libs since these are not completely thread-safe (see attached gzip-ped module ldapthreading). For letting other threads run the *_s() methods internally convert the synchronous call from the application to asynchronous LDAPObject method calls. Especially the result() method tries to do the timeout handling to avoid hanging around in a ldap_result() call. This seems to work in most situations (on my S.u.S.E. Linux 7.0 box). However it seems to me that the implementation of the result() in python-ldap's LDAPObject.c is not really asynchronous. Look at the following situation: The LDAPObject.result() method is called like r = l.result(msgid,all=0,timeout=0) This returns a tuple (restype,result) if the LDAP server has already sent a result. But what happens if the LDAP server did not send anything so far? I would expect l.result() to return None in this case indicating that no result was received so far which seems to be the case. But how to distinguish between the LDAP server is still gathering data and sent nothing so far and reaching the end of received results? My tests are showing that in most cases None is also given back byresult() when end of search results is reached. Ciao, Michael. |