summaryrefslogtreecommitdiffstats
path: root/src/providers/fail_over.c
diff options
context:
space:
mode:
authorPavel Reichl <preichl@redhat.com>2014-02-10 15:01:35 +0000
committerJakub Hrozek <jhrozek@redhat.com>2014-04-14 12:56:44 +0200
commit8ed6630fb25c7d5af6e2d9915786b94600198b01 (patch)
tree6a7725489b36bfb599838c4a3bbbbab081b3efb5 /src/providers/fail_over.c
parent4f6931e854c698dcb1c09f99eb330ce2fb97e7c6 (diff)
downloadsssd-8ed6630fb25c7d5af6e2d9915786b94600198b01.tar.gz
sssd-8ed6630fb25c7d5af6e2d9915786b94600198b01.tar.xz
sssd-8ed6630fb25c7d5af6e2d9915786b94600198b01.zip
failover: Shorter retry time for failed SRV
Until now there was only one timeout used to re-resolve SRV queries. This patch adds new (shorter) timeout that will be used for queries that previously failed. Resolves: https://fedorahosted.org/sssd/ticket/1885 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/providers/fail_over.c')
-rw-r--r--src/providers/fail_over.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index e10556c99..c45fe9c49 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -150,6 +150,7 @@ fo_context_init(TALLOC_CTX *mem_ctx, struct fo_options *opts)
}
ctx->opts->srv_retry_timeout = opts->srv_retry_timeout;
+ ctx->opts->srv_retry_neg_timeout = opts->srv_retry_neg_timeout;
ctx->opts->retry_timeout = opts->retry_timeout;
ctx->opts->family_order = opts->family_order;
ctx->opts->service_resolv_timeout = opts->service_resolv_timeout;
@@ -265,9 +266,15 @@ get_srv_data_status(struct srv_data *data)
struct timeval tv;
time_t timeout;
- timeout = data->meta->service->ctx->opts->srv_retry_timeout;
gettimeofday(&tv, NULL);
+ /* Determine timeout value based on state of previous lookup. */
+ if (data->srv_lookup_status == SRV_RESOLVE_ERROR) {
+ timeout = data->meta->service->ctx->opts->srv_retry_neg_timeout;
+ } else {
+ timeout = data->meta->service->ctx->opts->srv_retry_timeout;
+ }
+
if (timeout && STATUS_DIFF(data, tv) > timeout) {
switch(data->srv_lookup_status) {
case SRV_EXPIRED:
@@ -280,6 +287,9 @@ get_srv_data_status(struct srv_data *data)
case SRV_RESOLVE_ERROR:
data->srv_lookup_status = SRV_NEUTRAL;
data->last_status_change.tv_sec = 0;
+ DEBUG(SSSDBG_TRACE_FUNC,
+ "Changing state of SRV lookup from 'SRV_RESOLVE_ERROR' to "
+ "'SRV_NEUTRAL'.\n.");
break;
default:
DEBUG(SSSDBG_CRIT_FAILURE, "Unknown state for SRV server!\n");
@@ -1022,7 +1032,7 @@ fo_resolve_service_activate_timeout(struct tevent_req *req,
tv = tevent_timeval_current();
tv = tevent_timeval_add(&tv, timeout_seconds, 0);
state->timeout_handler = tevent_add_timer(ev, state, tv,
- fo_resolve_service_timeout, req);
+ fo_resolve_service_timeout, req);
if (state->timeout_handler == NULL) {
DEBUG(SSSDBG_CRIT_FAILURE, "tevent_add_timer failed.\n");
return ENOMEM;