diff options
author | venaas <venaas> | 2008-04-14 13:56:53 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2008-04-14 13:56:53 +0000 |
commit | f9cb45453fb88c6c42246abfd08374c16b3e636d (patch) | |
tree | 92eb81efbb9efa6214ba06e607f0ab27d6caf8a8 | |
parent | aeb7a66bfcb5ac292c4c22b7157c5b05ba4dbba8 (diff) |
fixed problem with recovering from server connection going down and made reconnect timeouts more aggressive
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/branches/release-1.1@228 e88ac4ed-0b26-0410-9574-a7f39faa03bf
-rw-r--r-- | radsecproxy.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/radsecproxy.c b/radsecproxy.c index 705b83c..a2ceeb3 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -784,15 +784,15 @@ void tlsconnect(struct server *server, struct timeval *when, char *text) { elapsed = now.tv_sec - server->lastconnecttry.tv_sec; if (server->connectionok) { server->connectionok = 0; - sleep(10); - } else if (elapsed < 5) - sleep(10); - else if (elapsed < 300) { + sleep(2); + } else if (elapsed < 1) + sleep(2); + else if (elapsed < 60) { debug(DBG_INFO, "tlsconnect: sleeping %lds", elapsed); sleep(elapsed); } else if (elapsed < 100000) { - debug(DBG_INFO, "tlsconnect: sleeping %ds", 600); - sleep(600); + debug(DBG_INFO, "tlsconnect: sleeping %ds", 60); + sleep(60); } else server->lastconnecttry.tv_sec = now.tv_sec; /* no sleep at startup */ debug(DBG_WARN, "tlsconnect: trying to open TLS connection to %s port %s", server->conf->host, server->conf->port); @@ -1643,10 +1643,12 @@ void respondreject(struct request *rq, char *message) { struct server *realm2server(struct realm *realm) { struct list_node *entry; - struct server *server, *best = NULL; + struct server *server, *best = NULL, *first = NULL; for (entry = list_first(realm->srvconfs); entry; entry = list_next(entry)) { server = ((struct clsrvconf *)entry->data)->servers; + if (!first) + first = server; if (!server->connectionok) continue; if (!server->loststatsrv) @@ -1658,7 +1660,7 @@ struct server *realm2server(struct realm *realm) { if (server->loststatsrv < best->loststatsrv) best = server; } - return best; + return best ? best : first; } void radsrv(struct request *rq) { |