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 Aug 26, 2013
1 parent 185d4c5 commit 4920ff4
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 @@ -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;
Expand Down Expand Up @@ -1440,6 +1456,7 @@ int radsrv(struct request *rq) {
goto exit;
}

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

Expand Down

0 comments on commit 4920ff4

Please sign in to comment.