summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2007-01-10 22:31:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:40:19 -0500
commitd38a7a39fa10a2567b5906480aa85fa0c5c8310a (patch)
tree533c5eb2e6129ea4ff3903cf75b32fd013691728 /source4/lib
parentf400fc4d0d8c110bf0077899d26f38283acaad7d (diff)
downloadsamba-d38a7a39fa10a2567b5906480aa85fa0c5c8310a.tar.gz
samba-d38a7a39fa10a2567b5906480aa85fa0c5c8310a.tar.bz2
samba-d38a7a39fa10a2567b5906480aa85fa0c5c8310a.zip
r20670: Make the logic more clear
(This used to be commit 906630f18e5fab4be6c40018aafe67df1e27c92e)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/modules/asq.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c
index 0c7cd7f0d4..413f6732ac 100644
--- a/source4/lib/ldb/modules/asq.c
+++ b/source4/lib/ldb/modules/asq.c
@@ -339,22 +339,25 @@ static int asq_search_continue(struct ldb_handle *handle)
handle->status = ac->base_req->handle->status;
goto done;
}
- if (ac->base_req->handle->state != LDB_ASYNC_DONE) {
- return LDB_SUCCESS;
- }
- /* build up the requests call chain */
- ret = asq_build_multiple_requests(ac, handle);
- if (ret != LDB_SUCCESS) {
- return ret;
- }
- if (handle->state == LDB_ASYNC_DONE) {
- return LDB_SUCCESS;
- }
+ if (ac->base_req->handle->state == LDB_ASYNC_DONE) {
+
+ /* build up the requests call chain */
+ ret = asq_build_multiple_requests(ac, handle);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ if (handle->state == LDB_ASYNC_DONE) {
+ return LDB_SUCCESS;
+ }
+
+ ac->step = ASQ_SEARCH_MULTI;
- ac->step = ASQ_SEARCH_MULTI;
+ return ldb_request(ac->module->ldb, ac->reqs[ac->cur_req]);
+ }
- return ldb_request(ac->module->ldb, ac->reqs[ac->cur_req]);
+ /* request still pending, return to cycle again */
+ return LDB_SUCCESS;
case ASQ_SEARCH_MULTI:
@@ -371,13 +374,16 @@ static int asq_search_continue(struct ldb_handle *handle)
if (ac->reqs[ac->cur_req]->handle->state == LDB_ASYNC_DONE) {
ac->cur_req++;
- if (ac->cur_req >= ac->num_reqs) {
- return asq_terminate(handle);
+ if (ac->cur_req < ac->num_reqs) {
+ return ldb_request(ac->module->ldb, ac->reqs[ac->cur_req]);
}
- return ldb_request(ac->module->ldb, ac->reqs[ac->cur_req]);
+ return asq_terminate(handle);
}
+ /* request still pending, return to cycle again */
+ return LDB_SUCCESS;
+
default:
ret = LDB_ERR_OPERATIONS_ERROR;
break;