Remove timeout event once we are calling the callback.
authorAndrew Bartlett <abartlet@samba.org>
Thu, 13 Nov 2008 03:07:29 +0000 (14:07 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 16 Nov 2008 23:07:24 +0000 (10:07 +1100)
(Even if the callback takes some time, this isn't a ldb_tdb timeout
any more)

Andrew Bartlett

source4/lib/ldb/ldb_tdb/ldb_tdb.c
source4/lib/ldb/ldb_tdb/ldb_tdb.h

index 34a4e0396573ff46448aef2d3d74776c8dcc8ea7..9e3ad80705fb08c20293d1564499aef740a25f05 100644 (file)
@@ -1076,12 +1076,14 @@ static void ltdb_callback(struct event_context *ev,
        }
 
        if (!ctx->callback_failed) {
+               /* Once we are done, we do not need timeout events */
+               talloc_free(ctx->timeout_event);
                ltdb_request_done(ctx->req, ret);
        }
 }
 
 static int ltdb_handle_request(struct ldb_module *module,
-                               struct ldb_request *req)
+                              struct ldb_request *req)
 {
        struct event_context *ev;
        struct ltdb_context *ac;
@@ -1115,10 +1117,9 @@ static int ltdb_handle_request(struct ldb_module *module,
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-
        tv.tv_sec = req->starttime + req->timeout;
-       te = event_add_timed(ev, ac, tv, ltdb_timeout, ac);
-       if (NULL == te) {
+       ac->timeout_event = event_add_timed(ev, ac, tv, ltdb_timeout, ac);
+       if (NULL == ac->timeout_event) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
index 61e90bccc69d99b0ce215365bf8f33f872c84432..c78a8172c72bd4625ffa38ca2e4270324a9819bf 100644 (file)
@@ -50,6 +50,7 @@ struct ltdb_context {
        struct ldb_dn *base;
        enum ldb_scope scope;
        const char * const *attrs;
+       struct timed_event *timeout_event;
 };
 
 /* special record types */