summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-02-25 16:18:04 +0100
committerSimo Sorce <ssorce@redhat.com>2011-02-28 11:53:03 -0500
commit6c9cb2b20ce9b9a1b9ce8d7485e95ac294555398 (patch)
tree12573ef3199817e145bf6cc8924e78b35fd62e30 /src/providers
parent073e71701dc28e21aaa1750d8b456ac699b8dda8 (diff)
downloadsssd-6c9cb2b20ce9b9a1b9ce8d7485e95ac294555398.tar.gz
sssd-6c9cb2b20ce9b9a1b9ce8d7485e95ac294555398.tar.xz
sssd-6c9cb2b20ce9b9a1b9ce8d7485e95ac294555398.zip
Reset server status after timeout
https://fedorahosted.org/sssd/ticket/809
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/fail_over.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index fc03946c0..a09a409d4 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -43,6 +43,10 @@
#define DEFAULT_SERVER_STATUS SERVER_NAME_NOT_RESOLVED
#define DEFAULT_SRV_STATUS SRV_NEUTRAL
+#ifndef HOSTNAME_RESOLVE_TIMEOUT
+#define HOSTNAME_RESOLVE_TIMEOUT 7200
+#endif /* HOSTNAME_RESOLVE_TIMEOUT */
+
enum srv_lookup_status {
SRV_NEUTRAL, /* We didn't try this SRV lookup yet */
SRV_RESOLVED, /* This SRV lookup is resolved */
@@ -320,7 +324,7 @@ get_server_status(struct fo_server *server)
DEBUG(4, ("Reseting the server status of '%s'\n",
SERVER_NAME(server)));
server->common->server_status = SERVER_NAME_NOT_RESOLVED;
- server->common->last_status_change.tv_sec = 0;
+ server->common->last_status_change.tv_sec = tv.tv_sec;
}
}
@@ -348,6 +352,12 @@ get_port_status(struct fo_server *server)
server->port, SERVER_NAME(server)));
server->port_status = PORT_NEUTRAL;
server->last_status_change.tv_sec = tv.tv_sec;
+
+ if (STATUS_DIFF(server->common, tv) > HOSTNAME_RESOLVE_TIMEOUT) {
+ DEBUG(4, ("Reseting the server status of '%s'\n",
+ SERVER_NAME(server)));
+ fo_set_server_status(server, SERVER_NAME_NOT_RESOLVED);
+ }
}
}