From 4920ff44a180c17addff089a42b8b0b8c16fef83 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Mon, 26 Aug 2013 14:25:51 +0200 Subject: Purge the duplication cache once per received packet. --- radsecproxy.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'radsecproxy.c') diff --git a/radsecproxy.c b/radsecproxy.c index caec987..2c001e5 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -1377,6 +1377,22 @@ struct request *newrequest() { return rq; } +static void +purgedupcache(struct client *client) { + struct request *r; + struct timeval now; + int i; + + gettimeofday(&now, NULL); + for (i = 0; i < MAX_REQUESTS; i++) { + r = client->rqs[i]; + if (r && now.tv_sec - r->created.tv_sec > r->from->conf->dupinterval) { + freerq(r); + client->rqs[i] = NULL; + } + } +} + int addclientrq(struct request *rq) { struct request *r; struct timeval now; @@ -1440,6 +1456,7 @@ int radsrv(struct request *rq) { goto exit; } + purgedupcache(from); if (!addclientrq(rq)) goto exit; -- cgit v1.1