diff options
author | Pavel Březina <pbrezina@redhat.com> | 2013-10-22 14:35:26 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-10-25 22:12:18 +0200 |
commit | 92eb5729e132e4f88ec41f1eb8db90ebd3a81a63 (patch) | |
tree | 911f1b7e49dde1dcd78f0e02ac9e934686270538 | |
parent | cd4cc8d8829f1ea5257bf874b91980368114275f (diff) | |
download | sssd-92eb5729e132e4f88ec41f1eb8db90ebd3a81a63.tar.gz sssd-92eb5729e132e4f88ec41f1eb8db90ebd3a81a63.tar.xz sssd-92eb5729e132e4f88ec41f1eb8db90ebd3a81a63.zip |
dp: store list of ongoing requests
Resolves:
https://fedorahosted.org/sssd/ticket/1968
-rw-r--r-- | src/providers/data_provider_be.c | 15 | ||||
-rw-r--r-- | src/providers/dp_backend.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index a0b2758b1..e6757b681 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -137,8 +137,18 @@ struct be_req { * selinux provider is calling the callback. */ int phase; + + struct be_req *prev; + struct be_req *next; }; +static int be_req_destructor(struct be_req *be_req) +{ + DLIST_REMOVE(be_req->be_ctx->active_requests, be_req); + + return 0; +} + struct be_req *be_req_create(TALLOC_CTX *mem_ctx, struct be_client *becli, struct be_ctx *be_ctx, be_async_callback_t fn, void *pvt_fn_data) @@ -153,6 +163,11 @@ struct be_req *be_req_create(TALLOC_CTX *mem_ctx, be_req->fn = fn; be_req->pvt = pvt_fn_data; + /* Add this request to active request list and make sure it is + * removed on termination. */ + DLIST_ADD(be_ctx->active_requests, be_req); + talloc_set_destructor(be_req, be_req_destructor); + return be_req; } diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h index fc71b60ca..686b91a25 100644 --- a/src/providers/dp_backend.h +++ b/src/providers/dp_backend.h @@ -150,6 +150,9 @@ struct be_ctx { struct be_refresh_ctx *refresh_ctx; size_t check_online_ref_count; + + /* List of ongoing requests */ + struct be_req *active_requests; }; struct bet_ops { |