svn commit: samba r20670 - in branches/SAMBA_4_0/source/lib/ldb/modules: .

idra at samba.org idra at samba.org
Wed Jan 10 22:31:43 GMT 2007


Author: idra
Date: 2007-01-10 22:31:42 +0000 (Wed, 10 Jan 2007)
New Revision: 20670

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20670

Log:

Make the logic more clear


Modified:
   branches/SAMBA_4_0/source/lib/ldb/modules/asq.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/modules/asq.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/modules/asq.c	2007-01-10 22:22:28 UTC (rev 20669)
+++ branches/SAMBA_4_0/source/lib/ldb/modules/asq.c	2007-01-10 22:31:42 UTC (rev 20670)
@@ -339,23 +339,26 @@
 			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 (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;
+
+			return ldb_request(ac->module->ldb, ac->reqs[ac->cur_req]);
 		}
-		if (handle->state == LDB_ASYNC_DONE) {
-			return LDB_SUCCESS;
-		}
 
-		ac->step = ASQ_SEARCH_MULTI;
+		/* request still pending, return to cycle again */
+		return LDB_SUCCESS;
 
-		return ldb_request(ac->module->ldb, ac->reqs[ac->cur_req]);
-
 	case ASQ_SEARCH_MULTI:
 
 		ret = ldb_wait(ac->reqs[ac->cur_req]->handle, LDB_WAIT_NONE);
@@ -371,13 +374,16 @@
 		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;



More information about the samba-cvs mailing list