]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
mdssvc: consolidate calls of mds_es_search_unset_pending()
authorRalph Boehme <slow@samba.org>
Fri, 19 Nov 2021 12:28:17 +0000 (13:28 +0100)
committerNoel Power <npower@samba.org>
Wed, 3 Aug 2022 13:00:36 +0000 (13:00 +0000)
Both codepaths were mds_es_search_unset_pending() is currently called end up
going through the higher level callback mds_es_search_done(). Moving the call to
mds_es_search_unset_pending() ensures we call it consistently and don't miss it
in some error code path.

Otherwise no change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14915

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/rpc_server/mdssvc/mdssvc_es.c

index a7a13f70c7be5c05c81a532f47a24ad8ea7d0b0a..cc79b42d14f6b9c44374f53bde71ce7cb9c994d9 100644 (file)
@@ -112,6 +112,7 @@ static struct tevent_req *mds_es_connect_send(
 static int mds_es_connect_recv(struct tevent_req *req);
 static void mds_es_connected(struct tevent_req *subreq);
 static bool mds_es_next_search_trigger(struct mds_es_ctx *mds_es_ctx);
+static void mds_es_search_unset_pending(struct sl_es_search *s);
 
 static bool mds_es_connect(struct mds_ctx *mds_ctx)
 {
@@ -440,6 +441,7 @@ static void mds_es_search_done(struct tevent_req *subreq)
 
        DBG_DEBUG("Search done for search [%p]\n", s);
 
+       mds_es_search_unset_pending(s);
        DLIST_REMOVE(mds_es_ctx->searches, s);
 
        ret = mds_es_search_recv(subreq);
@@ -650,7 +652,6 @@ static void mds_es_search_http_send_done(struct tevent_req *subreq)
        }
 
        if (state->s->mds_es_ctx->mds_ctx == NULL) {
-               mds_es_search_unset_pending(state->s);
                tevent_req_error(req, ECANCELED);
                return;
        }
@@ -685,8 +686,6 @@ static void mds_es_search_http_read_done(struct tevent_req *subreq)
 
        DBG_DEBUG("Got response for search [%p]\n", s);
 
-       mds_es_search_unset_pending(s);
-
        status = http_read_response_recv(subreq, state, &state->http_response);
        TALLOC_FREE(subreq);
        if (!NT_STATUS_IS_OK(status)) {