diff options
author | Simo Sorce <idra@samba.org> | 2006-03-10 15:27:16 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:56:56 -0500 |
commit | 3baf0606040419988f1a08c0da7f546c5904d8ca (patch) | |
tree | b0a0ea4edce4523b965690f23240d6a284d984f6 /source4/lib/ldb/ldb_ldap | |
parent | 3d9fc634ef8164a34adf14c0f77473c6268d2538 (diff) | |
download | samba-3baf0606040419988f1a08c0da7f546c5904d8ca.tar.gz samba-3baf0606040419988f1a08c0da7f546c5904d8ca.tar.bz2 samba-3baf0606040419988f1a08c0da7f546c5904d8ca.zip |
r14161: return early if we know the job is already finished
(This used to be commit 09f6f552d73f782dc8d62cefad9c5f584b7b07d2)
Diffstat (limited to 'source4/lib/ldb/ldb_ldap')
-rw-r--r-- | source4/lib/ldb/ldb_ldap/ldb_ldap.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index 5a4d911218..a2ca7a7cc8 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/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: |