diff options
| author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-05-03 12:29:03 +0200 |
|---|---|---|
| committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-05-03 12:29:03 +0200 |
| commit | 9430aa0d3a982d7759bb5d7db1be9b64064550ec (patch) | |
| tree | a85e4173149435735ab0da8e186b58ad5d914c52 /plugins | |
| parent | 1bfaf4ac06e82c0e4008a2b851043a09aee1a2e3 (diff) | |
| parent | ec7501e7956f356d1e79a062340c244e67d5ef24 (diff) | |
Merge branch 'v5-stable' into v5-devel
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/imuxsock/imuxsock.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index 86393ba6..af034b9f 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -432,7 +432,8 @@ finalize_it: /* find ratelimiter to use for this message. Currently, we use the * pid, but may change to cgroup later (probably via a config switch). - * Returns NULL if not found. + * Returns NULL if not found or rate-limiting not activated for this + * listener (the latter being a performance enhancement). */ static inline rsRetVal findRatelimiter(lstn_t *pLstn, struct ucred *cred, rs_ratelimit_state_t **prl) @@ -444,6 +445,10 @@ findRatelimiter(lstn_t *pLstn, struct ucred *cred, rs_ratelimit_state_t **prl) if(cred == NULL) FINALIZE; + if(pLstn->ratelimitInterval == 0) { + *prl = NULL; + FINALIZE; + } rl = hashtable_search(pLstn->ht, &cred->pid); if(rl == NULL) { @@ -454,7 +459,7 @@ findRatelimiter(lstn_t *pLstn, struct ucred *cred, rs_ratelimit_state_t **prl) CHKmalloc(rl = malloc(sizeof(rs_ratelimit_state_t))); CHKmalloc(keybuf = malloc(sizeof(pid_t))); *keybuf = cred->pid; - initRatelimitState(rl, ratelimitInterval, pLstn->ratelimitBurst); + initRatelimitState(rl, pLstn->ratelimitInterval, pLstn->ratelimitBurst); r = hashtable_insert(pLstn->ht, keybuf, rl); if(r == 0) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); |
