summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2010-05-18 11:11:52 +0200
committerStephen Gallagher <sgallagh@redhat.com>2010-05-27 14:44:13 -0400
commit6f5472ad13a013bacd66d2f32a5addfe535239f3 (patch)
tree24a66523adda45ca7cd278204224828e4b2fe1ba
parentd3e7cadfc9a09d6e3f7ae1f7f33c7dddd0bb1661 (diff)
downloadsssd-6f5472ad13a013bacd66d2f32a5addfe535239f3.tar.gz
sssd-6f5472ad13a013bacd66d2f32a5addfe535239f3.tar.bz2
sssd-6f5472ad13a013bacd66d2f32a5addfe535239f3.zip
Add run_callbacks flag
-rw-r--r--src/providers/data_provider_fo.c25
-rw-r--r--src/providers/dp_backend.h2
2 files changed, 25 insertions, 2 deletions
diff --git a/src/providers/data_provider_fo.c b/src/providers/data_provider_fo.c
index 14ebbdb5..56a072ae 100644
--- a/src/providers/data_provider_fo.c
+++ b/src/providers/data_provider_fo.c
@@ -42,6 +42,7 @@ struct be_svc_data {
struct fo_service *fo_service;
struct fo_server *last_good_srv;
+ bool run_callbacks;
struct be_svc_callback *callbacks;
};
@@ -414,9 +415,11 @@ static void be_resolve_server_done(struct tevent_req *subreq)
fo_get_server_name(state->srv), ipaddr));
}
- /* now call all svc callbacks if server changed */
- if (state->srv != state->svc->last_good_srv) {
+ /* now call all svc callbacks if server changed or if it is explicitly
+ * requested */
+ if (state->srv != state->svc->last_good_srv || state->svc->run_callbacks) {
state->svc->last_good_srv = state->srv;
+ state->svc->run_callbacks = false;
DLIST_FOR_EACH(callback, state->svc->callbacks) {
callback->fn(callback->private_data, state->srv);
@@ -440,3 +443,21 @@ int be_resolve_server_recv(struct tevent_req *req, struct fo_server **srv)
return EOK;
}
+int be_fo_run_callbacks_at_next_request(struct be_ctx *ctx,
+ const char *service_name)
+{
+ struct be_svc_data *svc;
+
+ DLIST_FOR_EACH(svc, ctx->be_fo->svcs) {
+ if (strcmp(svc->name, service_name) == 0) {
+ break;
+ }
+ }
+ if (NULL == svc) {
+ return ENOENT;
+ }
+
+ svc->run_callbacks = true;
+
+ return EOK;
+}
diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h
index fc5e558c..0668859b 100644
--- a/src/providers/dp_backend.h
+++ b/src/providers/dp_backend.h
@@ -177,4 +177,6 @@ struct tevent_req *be_resolve_server_send(TALLOC_CTX *memctx,
const char *service_name);
int be_resolve_server_recv(struct tevent_req *req, struct fo_server **srv);
+int be_fo_run_callbacks_at_next_request(struct be_ctx *ctx,
+ const char *service_name);
#endif /* __DP_BACKEND_H___ */