Completely async...

Michael Ströder michael at stroeder.com
Tue Apr 17 16:05:10 CEST 2001


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ldapthreading-1.9.py.gz
Type: application/x-gzip
Size: 1591 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20010417/e665e007/attachment.bin>


More information about the python-ldap mailing list