Skip to content

Commit

Permalink
Reroute errback to deferred returned by search()
Browse files Browse the repository at this point in the history
The LDAPEntryWithClient.search() method used to send the LDAP request with
a call like
	self.client.send_multiResponse(... )
send_multiResponse() returns a deferred that was just discarded. If the
operation causes an error then the errback fired on the discarded deferred
will remain unhandled. The deferred returned by search() will then not
have any errback fired and the caller of search() will be waiting forever.

This change adds an errback to the deferred returned by send_multiResponse()
and has the error rerouted to the errback chain of the deferred returned by
search().
  • Loading branch information
antong committed Sep 1, 2010
1 parent 5ab62a6 commit 6a34562
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ldaptor/protocols/ldap/ldapsyntax.py
Expand Up @@ -683,7 +683,7 @@ def search(self,
typesOnly=typesOnly,
filter=filterObject,
attributes=attributes)
self.client.send_multiResponse(
dsend = self.client.send_multiResponse(
op, self._cbSearchMsg,
d, cb, complete=not attributes,
sizeLimitIsNonFatal=sizeLimitIsNonFatal)
Expand All @@ -692,6 +692,11 @@ def search(self,
else:
if callback is None:
d.addCallback(lambda dummy: results)
def rerouteerr(e):
d.errback(e)
# returning None will stop the error
# from being propagated and logged.
dsend.addErrback(rerouteerr)
return d

def lookup(self, dn):
Expand Down

0 comments on commit 6a34562

Please sign in to comment.