diff options
Diffstat (limited to 'runtime/ratelimit.c')
-rw-r--r-- | runtime/ratelimit.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/runtime/ratelimit.c b/runtime/ratelimit.c index a808e04..016fd3c 100644 --- a/runtime/ratelimit.c +++ b/runtime/ratelimit.c @@ -73,16 +73,8 @@ static inline rsRetVal doLastMessageRepeatedNTimes(ratelimit_t *ratelimit, msg_t *pMsg, msg_t **ppRepMsg) { int bNeedUnlockMutex = 0; - rsRetVal localRet; DEFiRet; - if((pMsg->msgFlags & NEEDS_PARSING) != 0) { - if((localRet = parser.ParseMsg(pMsg)) != RS_RET_OK) { - DBGPRINTF("Message discarded, parsing error %d\n", localRet); - ABORT_FINALIZE(RS_RET_DISCARDMSG); - } - } - if(ratelimit->bThreadSafe) { pthread_mutex_lock(&ratelimit->mut); bNeedUnlockMutex = 1; @@ -209,6 +201,14 @@ rsRetVal ratelimitMsg(ratelimit_t *ratelimit, msg_t *pMsg, msg_t **ppRepMsg) { DEFiRet; + rsRetVal localRet; + + if((pMsg->msgFlags & NEEDS_PARSING) != 0) { + if((localRet = parser.ParseMsg(pMsg)) != RS_RET_OK) { + DBGPRINTF("Message discarded, parsing error %d\n", localRet); + ABORT_FINALIZE(RS_RET_DISCARDMSG); + } + } *ppRepMsg = NULL; /* Only the messages having severity level at or below the @@ -223,6 +223,10 @@ ratelimitMsg(ratelimit_t *ratelimit, msg_t *pMsg, msg_t **ppRepMsg) CHKiRet(doLastMessageRepeatedNTimes(ratelimit, pMsg, ppRepMsg)); } finalize_it: + if(Debug) { + if(iRet == RS_RET_DISCARDMSG) + dbgprintf("message discarded by ratelimiting\n"); + } RETiRet; } |