summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_sqlite3
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-03-10 15:27:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:56:56 -0500
commit3baf0606040419988f1a08c0da7f546c5904d8ca (patch)
treeb0a0ea4edce4523b965690f23240d6a284d984f6 /source4/lib/ldb/ldb_sqlite3
parent3d9fc634ef8164a34adf14c0f77473c6268d2538 (diff)
downloadsamba-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_sqlite3')
-rw-r--r--source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
index d9d9269de4..bcb830c38d 100644
--- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
+++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
@@ -57,9 +57,9 @@ struct lsql_async_context {
int (*callback)(struct ldb_context *, void *, struct ldb_async_result *);
};
-static struct ldb_async_handle *init_lsql_handle(struct lsqlite3_private *lsqlite3, struct ldb_module *module,
- void *context,
- int (*callback)(struct ldb_context *, void *, struct ldb_async_result *))
+static struct ldb_async_handle *init_handle(struct lsqlite3_private *lsqlite3, struct ldb_module *module,
+ void *context,
+ int (*callback)(struct ldb_context *, void *, struct ldb_async_result *))
{
struct lsql_async_context *ac;
struct ldb_async_handle *h;
@@ -81,6 +81,9 @@ static struct ldb_async_handle *init_lsql_handle(struct lsqlite3_private *lsqlit
h->private_data = (void *)ac;
+ h->state = LDB_ASYNC_INIT;
+ h->status = LDB_SUCCESS;
+
ac->module = module;
ac->context = context;
ac->callback = callback;
@@ -899,7 +902,7 @@ int lsql_search_async(struct ldb_module *module, const struct ldb_dn *base,
char *query = NULL;
int ret;
- *handle = init_lsql_handle(lsqlite3, module, context, callback);
+ *handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
talloc_free(*handle);
return LDB_ERR_OPERATIONS_ERROR;
@@ -1111,7 +1114,7 @@ static int lsql_add_async(struct ldb_module *module, struct ldb_message *msg,
int i;
int ret = LDB_ERR_OPERATIONS_ERROR;
- *handle = init_lsql_handle(lsqlite3, module, context, callback);
+ *handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}
@@ -1267,7 +1270,7 @@ static int lsql_modify_async(struct ldb_module *module, const struct ldb_message
int i;
int ret = LDB_ERR_OPERATIONS_ERROR;
- *handle = init_lsql_handle(lsqlite3, module, context, callback);
+ *handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}
@@ -1481,7 +1484,7 @@ static int lsql_delete_async(struct ldb_module *module, const struct ldb_dn *dn,
int ret = LDB_ERR_OPERATIONS_ERROR;
- *handle = init_lsql_handle(lsqlite3, module, context, callback);
+ *handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}
@@ -1559,7 +1562,7 @@ static int lsql_rename_async(struct ldb_module *module, const struct ldb_dn *old
char *query;
int ret = LDB_ERR_OPERATIONS_ERROR;
- *handle = init_lsql_handle(lsqlite3, module, context, callback);
+ *handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}