diff options
author | venaas <venaas> | 2008-07-31 09:55:09 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2008-07-31 09:55:09 +0000 |
commit | df95c2144732f5323e16d9cf91f55455743a4fa9 (patch) | |
tree | fd337ca6874a396074deb9c6cea2eeec43ec942f /radsecproxy.c | |
parent | bdc5b1b96526fca0b3ad7379cfb32e06d888b03b (diff) |
use lastrcv instead of lastsend for status-server
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@330 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r-- | radsecproxy.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/radsecproxy.c b/radsecproxy.c index 0067c20..6e341c2 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -2411,7 +2411,9 @@ int replyh(struct server *server, unsigned char *buf) { memcpy(buf + 4, tmp, 16); debug(DBG_DBG, "replyh: message auth ok"); } - + + gettimeofday(&server->lastrcv, NULL); + if (*rq->buf == RAD_Status_Server) { rq->received = 1; pthread_mutex_unlock(&server->newrq_mutex); @@ -2580,7 +2582,7 @@ void *clientwr(void *arg) { pthread_t clientrdth; int i, dynconffail = 0; uint8_t rnd; - struct timeval now, lastsend; + struct timeval now; struct timespec timeout; struct request statsrvrq; unsigned char statsrvbuf[38]; @@ -2607,7 +2609,7 @@ void *clientwr(void *arg) { statsrvbuf[3] = 38; statsrvbuf[20] = RAD_Attr_Message_Authenticator; statsrvbuf[21] = 18; - gettimeofday(&lastsend, NULL); + gettimeofday(&server->lastrcv, NULL); } if (conf->pdef->connecter) { @@ -2629,8 +2631,8 @@ void *clientwr(void *arg) { RAND_bytes(&rnd, 1); rnd /= 32; 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; + if (!timeout.tv_sec || timeout.tv_sec > server->lastrcv.tv_sec + STATUS_SERVER_PERIOD + rnd) + timeout.tv_sec = server->lastrcv.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; @@ -2712,11 +2714,10 @@ void *clientwr(void *arg) { timeout.tv_sec = rq->expiry.tv_sec; rq->tries++; conf->pdef->clientradput(server, server->requests[i].buf); - gettimeofday(&lastsend, NULL); } if (conf->statusserver) { gettimeofday(&now, NULL); - if (now.tv_sec - lastsend.tv_sec >= STATUS_SERVER_PERIOD) { + if (now.tv_sec - server->lastrcv.tv_sec >= STATUS_SERVER_PERIOD) { if (!RAND_bytes(statsrvbuf + 4, 16)) { debug(DBG_WARN, "clientwr: failed to generate random auth"); continue; @@ -2728,7 +2729,6 @@ void *clientwr(void *arg) { } memcpy(statsrvrq.buf, statsrvbuf, sizeof(statsrvbuf)); debug(DBG_DBG, "clientwr: sending status server to %s", conf->host); - lastsend.tv_sec = now.tv_sec; sendrq(server, &statsrvrq); } } |