From 34116a32c78fbd33b595f5fce3d0d63ac7c7d70c Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Mon, 3 Jun 2013 10:40:12 +0200 Subject: [PATCH 3/3] Use queue for get_subdomains It does not make much sense to run multiple get_subdomains request in parallel because all requests will load the same information from the server. The IPA and AD provider already implement a short timeout to avoid the multiple requests are running to fast after each other. But if the timeout is over chances are that if two or more request come in fast the first request cannot update the timeout and request will run in parallel. To avoid this the requests are queued and send one after the other to the provider. --- src/providers/data_provider_be.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 49a7a89..53fa5cd 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -496,6 +496,8 @@ static void get_subdomains_callback(struct be_req *req, dp_err_type, errnum, errstr?errstr:"", dp_pam_err_to_string(req, dp_err_type, errnum))); + be_queue_next_request(req, BET_SUBDOMAINS); + reply = (DBusMessage *)req->pvt; if (reply) { @@ -629,9 +631,11 @@ static int be_get_subdomains(DBusMessage *message, struct sbus_connection *conn) be_req->req_data = req; - ret = be_file_request(becli->bectx, - be_req, - becli->bectx->bet_info[BET_SUBDOMAINS].bet_ops->handler); + ret = be_queue_request(becli->bectx, + &becli->bectx->bet_info[BET_SUBDOMAINS].req_queue, + becli->bectx, + be_req, + becli->bectx->bet_info[BET_SUBDOMAINS].bet_ops->handler); if (ret != EOK) { err_maj = DP_ERR_FATAL; err_min = ret; -- 1.7.7.6