Skip to content

Commit

Permalink
Purge the duplication cache once per received packet.
Browse files Browse the repository at this point in the history
  • Loading branch information
Linus Nordberg committed Sep 2, 2013
1 parent 1931a0d commit 536fbcd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions radsecproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1453,6 +1469,7 @@ int radsrv(struct request *rq) {
goto exit;
}

purgedupcache(from);
if (!addclientrq(rq))
goto exit;

Expand Down

0 comments on commit 536fbcd

Please sign in to comment.