summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvenaas <venaas>2008-06-13 09:35:26 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-06-13 09:35:26 +0000
commit9ebb9eed56f7f69255230d9d8ed77b83a824ae96 (patch)
tree92844a5ca883a91120d2e50789ed223c93387d22
parentb2415c4fab9c6b5cdf15bb007662493f0f433a95 (diff)
fixed serious probelm with idle timeout
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@292 e88ac4ed-0b26-0410-9574-a7f39faa03bf
-rw-r--r--radsecproxy.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index 8538ef9..b6071a6 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -2383,9 +2383,15 @@ void *clientwr(void *arg) {
/* random 0-7 seconds */
RAND_bytes(&rnd, 1);
rnd /= 32;
- if (!timeout.tv_sec || timeout.tv_sec > lastsend.tv_sec + STATUS_SERVER_PERIOD + rnd)
- timeout.tv_sec = lastsend.tv_sec + STATUS_SERVER_PERIOD + rnd;
- debug(DBG_DBG, "clientwr: waiting up to %ld secs for new request", timeout.tv_sec - now.tv_sec);
+ if (conf->statusserver) {
+ if (!timeout.tv_sec || timeout.tv_sec > lastsend.tv_sec + STATUS_SERVER_PERIOD + rnd)
+ timeout.tv_sec = lastsend.tv_sec + STATUS_SERVER_PERIOD + rnd;
+ } else {
+ if (!timeout.tv_sec || timeout.tv_sec > now.tv_sec + STATUS_SERVER_PERIOD + rnd)
+ timeout.tv_sec = now.tv_sec + STATUS_SERVER_PERIOD + rnd;
+ }
+ if (timeout.tv_sec > now.tv_sec)
+ debug(DBG_DBG, "clientwr: waiting up to %ld secs for new request", timeout.tv_sec - now.tv_sec);
pthread_cond_timedwait(&server->newrq_cond, &server->newrq_mutex, &timeout);
timeout.tv_sec = 0;
}