diff options
| author | Linus Nordberg <linus@nordberg.se> | 2013-08-26 14:25:51 +0200 | 
|---|---|---|
| committer | Linus Nordberg <linus@nordberg.se> | 2013-09-02 13:46:55 +0200 | 
| commit | 536fbcd6f4b7aa35a689581372d70b4399ce5707 (patch) | |
| tree | 7c87702588d45ab603d7ed356b8fd45929b37b76 /radsecproxy.c | |
| parent | 1931a0d54ad65f0681300ea040c7fa9f9cd6685b (diff) | |
Purge the duplication cache once per received packet.
Diffstat (limited to 'radsecproxy.c')
| -rw-r--r-- | radsecproxy.c | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/radsecproxy.c b/radsecproxy.c index d05f9c9..3e4f360 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -1390,6 +1390,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; @@ -1453,6 +1469,7 @@ int radsrv(struct request *rq) {  	goto exit;      } +    purgedupcache(from);      if (!addclientrq(rq))  	goto exit; | 
