summaryrefslogtreecommitdiffstats
path: root/src/providers/data_provider_fo.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-03-07 17:08:52 +0100
committerStephen Gallagher <sgallagh@redhat.com>2012-06-04 14:16:13 -0400
commit14b463120f867bb41ce4a7575fb668f66817534c (patch)
tree03c47d5e09d6a41747a90620647374010a277d6a /src/providers/data_provider_fo.c
parent29354a2741ae120c084929b436099eba8c68de35 (diff)
downloadsssd-14b463120f867bb41ce4a7575fb668f66817534c.tar.gz
sssd-14b463120f867bb41ce4a7575fb668f66817534c.tar.xz
sssd-14b463120f867bb41ce4a7575fb668f66817534c.zip
Detect cycle in the fail over on subsequent resolve requests only
Diffstat (limited to 'src/providers/data_provider_fo.c')
-rw-r--r--src/providers/data_provider_fo.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/providers/data_provider_fo.c b/src/providers/data_provider_fo.c
index 5d634cab9..d5cb0a476 100644
--- a/src/providers/data_provider_fo.c
+++ b/src/providers/data_provider_fo.c
@@ -352,6 +352,7 @@ struct be_resolve_server_state {
int attempts;
struct fo_server *srv;
+ bool first_try;
};
static void be_resolve_server_done(struct tevent_req *subreq);
@@ -359,7 +360,8 @@ static void be_resolve_server_done(struct tevent_req *subreq);
struct tevent_req *be_resolve_server_send(TALLOC_CTX *memctx,
struct tevent_context *ev,
struct be_ctx *ctx,
- const char *service_name)
+ const char *service_name,
+ bool first_try)
{
struct tevent_req *req, *subreq;
struct be_resolve_server_state *state;
@@ -380,6 +382,7 @@ struct tevent_req *be_resolve_server_send(TALLOC_CTX *memctx,
state->svc = svc;
state->attempts = 0;
+ state->first_try = first_try;
subreq = fo_resolve_service_send(state, ev,
ctx->be_fo->resolv,
@@ -452,7 +455,7 @@ static void be_resolve_server_done(struct tevent_req *subreq)
}
/* all fine we got the server */
- if (state->svc->first_resolved == NULL) {
+ if (state->svc->first_resolved == NULL || state->first_try == true) {
DEBUG(7, ("Saving the first resolved server\n"));
state->svc->first_resolved = state->srv;
} else if (state->svc->first_resolved == state->srv) {