summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorvenaas <venaas>2007-01-03 13:29:46 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2007-01-03 13:29:46 +0000
commit1974dbac0e01a5187e24950cb0506916cd90b94d (patch)
tree4c28b69686f6eca8355c878694a3a0b22c1328cd /radsecproxy.c
parent60d9b64a571ccd841ef858fc98e0d27c429ba0a1 (diff)
tlsconnect changes
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@5 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index 5374403..0a405d1 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -227,7 +227,7 @@ void tlsconnect(struct peer *peer, struct timeval *when, char *text) {
struct timeval now;
time_t elapsed;
unsigned long error;
-
+
pthread_mutex_lock(&peer->lock);
if (when && memcmp(&peer->lastconnecttry, when, sizeof(struct timeval))) {
/* already reconnected, nothing to do */
@@ -241,16 +241,15 @@ void tlsconnect(struct peer *peer, struct timeval *when, char *text) {
for (;;) {
printf("tlsconnect: trying to open TLS connection to %s port %s\n", peer->host, peer->port);
gettimeofday(&now, NULL);
- if (when) { // don't wait first time
- elapsed = now.tv_sec - peer->lastconnecttry.tv_sec;
- if (peer->connectionok) {
- peer->connectionok = 0;
- sleep(10);
- } else if (elapsed < 5)
- sleep(10);
- else if (elapsed < 600)
- sleep(elapsed * 2);
- else
+ elapsed = now.tv_sec - peer->lastconnecttry.tv_sec;
+ if (peer->connectionok) {
+ peer->connectionok = 0;
+ sleep(10);
+ } else if (elapsed < 5)
+ sleep(10);
+ else if (elapsed < 600)
+ sleep(elapsed * 2);
+ else if (elapsed < 10000) /* no sleep at startup */
sleep(900);
}
if (peer->sockcl >= 0)