summaryrefslogtreecommitdiffstats
path: root/src/responder/common
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2012-10-11 21:19:44 +0200
committerJakub Hrozek <jhrozek@redhat.com>2012-10-12 16:42:17 +0200
commit99bac83188601c2b07e0b141aac7dc7d882b464a (patch)
tree158178d13dabe5cb710e5d86301dd8e0588ed489 /src/responder/common
parent8445e39d8e154523b1c39ce701830dacef51d1e9 (diff)
downloadsssd-99bac83188601c2b07e0b141aac7dc7d882b464a.tar.gz
sssd-99bac83188601c2b07e0b141aac7dc7d882b464a.tar.xz
sssd-99bac83188601c2b07e0b141aac7dc7d882b464a.zip
Save time of last get_domains request
Diffstat (limited to 'src/responder/common')
-rw-r--r--src/responder/common/responder_get_domains.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/responder/common/responder_get_domains.c b/src/responder/common/responder_get_domains.c
index 9e81630f4..f4bcbf14c 100644
--- a/src/responder/common/responder_get_domains.c
+++ b/src/responder/common/responder_get_domains.c
@@ -131,6 +131,7 @@ get_next_domain_recv(TALLOC_CTX *mem_ctx,
/* ====== Iterate over all domains, searching for their subdomains ======= */
static errno_t process_subdomains(struct sss_domain_info *dom);
+static void set_time_of_last_request(struct resp_ctx *rctx);
static errno_t check_last_request(struct resp_ctx *rctx, const char *hint);
struct sss_dp_get_domains_state {
@@ -211,6 +212,7 @@ struct tevent_req *sss_dp_get_domains_send(TALLOC_CTX *mem_ctx,
immediately:
if (ret == EOK) {
+ set_time_of_last_request(rctx);
tevent_req_done(req);
} else {
tevent_req_error(req, ret);
@@ -255,6 +257,7 @@ sss_dp_get_domains_process(struct tevent_req *subreq)
if (state->dom == NULL) {
/* All domains were local */
+ set_time_of_last_request(state->rctx);
tevent_req_done(req);
return;
}
@@ -370,6 +373,19 @@ errno_t sss_dp_get_domains_recv(struct tevent_req *req)
return EOK;
}
+static void set_time_of_last_request(struct resp_ctx *rctx)
+{
+ int ret;
+
+ errno = 0;
+ ret = gettimeofday(&rctx->get_domains_last_call, NULL);
+ if (ret == -1) {
+ ret = errno;
+ DEBUG(SSSDBG_TRACE_FUNC, ("gettimeofday failed [%d][%s].\n",
+ ret, strerror(ret)));
+ }
+}
+
static errno_t check_last_request(struct resp_ctx *rctx, const char *hint)
{
struct sss_domain_info *dom;