tldap: Fix tldap_msg_received()
[amitay/samba.git] / source3 / lib / tldap.c
index 9da0e0c086e6a4b9c645bd020f80de5bdb85eed9..9274db126c465205d2da1f56458249212f5248c3 100644 (file)
@@ -677,21 +677,13 @@ static void tldap_msg_received(struct tevent_req *subreq)
        tldap_msg_unset_pending(req);
        num_pending = talloc_array_length(ld->pending);
 
+       tevent_req_defer_callback(req, state->ev);
        tevent_req_done(req);
 
  done:
        if (num_pending == 0) {
                return;
        }
-       if (talloc_array_length(ld->pending) > num_pending) {
-               /*
-                * The callback functions called from tevent_req_done() above
-                * have put something on the pending queue. We don't have to
-                * trigger the read_ldap_send(), tldap_msg_set_pending() has
-                * done it for us already.
-                */
-               return;
-       }
 
        state = tevent_req_data(ld->pending[0], struct tldap_msg_state);
        subreq = read_ldap_send(ld->pending, state->ev, ld->conn);