diff options
author | venaas <venaas> | 2007-01-03 13:29:46 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2007-01-03 13:29:46 +0000 |
commit | 1974dbac0e01a5187e24950cb0506916cd90b94d (patch) | |
tree | 4c28b69686f6eca8355c878694a3a0b22c1328cd /radsecproxy.c | |
parent | 60d9b64a571ccd841ef858fc98e0d27c429ba0a1 (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.c | 21 |
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) |