summaryrefslogtreecommitdiffstats
path: root/source/lib/ldb/ldb_ldap
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-03-10 15:27:16 +0000
committerSimo Sorce <idra@samba.org>2006-03-10 15:27:16 +0000
commitd8c1a95c6aa8d10af50ef166e1830dd78762ec5b (patch)
tree65e49fc4a8eb27e937b67acbc9bee44ffdb3a0f2 /source/lib/ldb/ldb_ldap
parent0e8aa69127e47faf8ee903d8cf83edde4e74d5f5 (diff)
downloadsamba-d8c1a95c6aa8d10af50ef166e1830dd78762ec5b.tar.gz
samba-d8c1a95c6aa8d10af50ef166e1830dd78762ec5b.tar.xz
samba-d8c1a95c6aa8d10af50ef166e1830dd78762ec5b.zip
r14161: return early if we know the job is already finished
Diffstat (limited to 'source/lib/ldb/ldb_ldap')
-rw-r--r--source/lib/ldb/ldb_ldap/ldb_ldap.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/lib/ldb/ldb_ldap/ldb_ldap.c b/source/lib/ldb/ldb_ldap/ldb_ldap.c
index 5a4d9112187..a2ca7a7cc8c 100644
--- a/source/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -87,6 +87,9 @@ static struct ldb_async_handle *init_handle(struct lldb_private *lldb, struct ld
h->private_data = (void *)ac;
+ h->state = LDB_ASYNC_INIT;
+ h->status = LDB_SUCCESS;
+
ac->module = module;
ac->context = context;
ac->callback = callback;
@@ -885,12 +888,15 @@ static int lldb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_
LDAPMessage *result;
int ret = LDB_ERR_OPERATIONS_ERROR;
- if (!ac->msgid) {
+ if (handle->state == LDB_ASYNC_DONE) {
+ return handle->status;
+ }
+
+ if (!ac || !ac->msgid) {
return LDB_ERR_OPERATIONS_ERROR;
}
handle->status = LDB_SUCCESS;
- handle->state = LDB_ASYNC_INIT;
switch(type) {
case LDB_WAIT_NONE: