diff options
author | Michael Biebl <biebl@debian.org> | 2011-05-19 22:53:09 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2011-05-19 22:53:09 +0200 |
commit | 734f0031f3366c83552de8b0e628949d47ff9487 (patch) | |
tree | 75cb2c0985c21bc7ffd6d06e94ec7fb420f2a1c4 /plugins/imuxsock/imuxsock.c | |
parent | 2e96de39e5394008f97d6c194e507e629d836738 (diff) | |
download | rsyslog-734f0031f3366c83552de8b0e628949d47ff9487.tar.gz |
Imported Upstream version 5.8.1upstream/5.8.1
Diffstat (limited to 'plugins/imuxsock/imuxsock.c')
-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 86393ba..af034b9 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); |