libcli/cldap: pass tevent_context to cldap_search_send()
authorStefan Metzmacher <metze@samba.org>
Mon, 10 Oct 2011 13:46:17 +0000 (15:46 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 10 Oct 2011 19:50:26 +0000 (21:50 +0200)
metze

libcli/cldap/cldap.c
libcli/cldap/cldap.h
source4/torture/ldap/cldapbench.c

index c73d37466c08fca9f45da3b5848b9814e0876633..9253629ba57f58a15822ed91538a043a65b4b457 100644 (file)
@@ -98,6 +98,7 @@ struct cldap_search_state {
        struct cldap_search_state *prev, *next;
 
        struct {
+               struct tevent_context *ev;
                struct cldap_socket *cldap;
        } caller;
 
@@ -535,8 +536,9 @@ static void cldap_search_state_wakeup_done(struct tevent_req *subreq);
   queue a cldap reply for send
 */
 struct tevent_req *cldap_search_send(TALLOC_CTX *mem_ctx,
-                                   struct cldap_socket *cldap,
-                                   const struct cldap_search *io)
+                                    struct tevent_context *ev,
+                                    struct cldap_socket *cldap,
+                                    const struct cldap_search *io)
 {
        struct tevent_req *req, *subreq;
        struct cldap_search_state *state = NULL;
@@ -553,6 +555,7 @@ struct tevent_req *cldap_search_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
        ZERO_STRUCTP(state);
+       state->caller.ev = ev;
        state->req = req;
        state->caller.cldap = cldap;
        state->message_id = -1;
@@ -818,7 +821,7 @@ NTSTATUS cldap_search(struct cldap_socket *cldap,
                return NT_STATUS_PIPE_BUSY;
        }
 
-       req = cldap_search_send(mem_ctx, cldap, io);
+       req = cldap_search_send(mem_ctx, cldap->event.ctx, cldap, io);
        NT_STATUS_HAVE_NO_MEMORY(req);
 
        if (!tevent_req_poll(req, cldap->event.ctx)) {
@@ -931,7 +934,7 @@ struct tevent_req *cldap_netlogon_send(TALLOC_CTX *mem_ctx,
        state->search.in.timeout        = 2;
        state->search.in.retries        = 2;
 
-       subreq = cldap_search_send(state, cldap, &state->search);
+       subreq = cldap_search_send(state, ev, cldap, &state->search);
        if (tevent_req_nomem(subreq, req)) {
                goto post;
        }
index bf259e9aa5a896056518167497170863d134e3fc..10c92959e0d30499d59d3efe55ef2868c4108379 100644 (file)
@@ -64,6 +64,7 @@ NTSTATUS cldap_set_incoming_handler(struct cldap_socket *cldap,
                                                    struct cldap_incoming *),
                                    void *private_data);
 struct tevent_req *cldap_search_send(TALLOC_CTX *mem_ctx,
+                                    struct tevent_context *ev,
                                     struct cldap_socket *cldap,
                                     const struct cldap_search *io);
 NTSTATUS cldap_search_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
index 118881d03490fde30d4ed7a9985e8a324d1a5864..9b87ae31388a1eff8babd601ed298adf00618cab 100644 (file)
@@ -172,7 +172,7 @@ static bool bench_cldap_rootdse(struct torture_context *tctx, const char *addres
        while (timeval_elapsed(&tv) < timelimit) {
                while (num_sent - (state->pass_count+state->fail_count) < 10) {
                        struct tevent_req *req;
-                       req = cldap_search_send(state, cldap, &search);
+                       req = cldap_search_send(state, tctx->ev, cldap, &search);
 
                        tevent_req_set_callback(req, request_rootdse_handler, state);