diff options
-rw-r--r-- | src/providers/fail_over.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c index 37ffe268..92089226 100644 --- a/src/providers/fail_over.c +++ b/src/providers/fail_over.c @@ -318,8 +318,8 @@ get_server_status(struct fo_server *server) str_server_status(server->common->server_status))); timeout = server->service->ctx->opts->retry_timeout; + gettimeofday(&tv, NULL); if (timeout != 0 && server->common->server_status == SERVER_NOT_WORKING) { - gettimeofday(&tv, NULL); if (STATUS_DIFF(server->common, tv) > timeout) { DEBUG(4, ("Reseting the server status of '%s'\n", SERVER_NAME(server))); @@ -328,6 +328,12 @@ get_server_status(struct fo_server *server) } } + if (STATUS_DIFF(server->common, tv) > HOSTNAME_RESOLVE_TIMEOUT) { + DEBUG(4, ("Hostname resolution expired, reseting the server " + "status of '%s'\n", SERVER_NAME(server))); + fo_set_server_status(server, SERVER_NAME_NOT_RESOLVED); + } + return server->common->server_status; } @@ -352,13 +358,6 @@ 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 (server->common != NULL && - 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); - } } } |