summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-04-27 17:59:11 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-04-27 17:59:11 +0200
commit5930014cddf4ed5a5d0970f2a3b16be002c1ce4c (patch)
treee2fe83c0c576ee285c136d500de2838b1e5b5397 /plugins
parent6093f3110306e0575d10d09807da1e6895af4eba (diff)
parent24b62834801043bf2d9560b0cca3967e5762bea1 (diff)
downloadrsyslog-5930014cddf4ed5a5d0970f2a3b16be002c1ce4c.tar.gz
rsyslog-5930014cddf4ed5a5d0970f2a3b16be002c1ce4c.tar.xz
rsyslog-5930014cddf4ed5a5d0970f2a3b16be002c1ce4c.zip
Merge branch 'v5-stable'
Conflicts: tools/syslogd.c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/imuxsock/imuxsock.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index e559e6a6..cbf87d7f 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);