From 9ebb9eed56f7f69255230d9d8ed77b83a824ae96 Mon Sep 17 00:00:00 2001 From: venaas Date: Fri, 13 Jun 2008 09:35:26 +0000 Subject: fixed serious probelm with idle timeout git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@292 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- radsecproxy.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'radsecproxy.c') 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; } -- cgit v1.1