summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/batch.h19
-rw-r--r--runtime/rsyslog.h2
-rw-r--r--runtime/rule.c28
-rw-r--r--runtime/ruleset.c1
4 files changed, 27 insertions, 23 deletions
diff --git a/runtime/batch.h b/runtime/batch.h
index 80621631..b555fc2a 100644
--- a/runtime/batch.h
+++ b/runtime/batch.h
@@ -174,4 +174,23 @@ batchInit(batch_t *pBatch, int maxElem) {
finalize_it:
RETiRet;
}
+
+
+/* primarily a helper for debug purposes, get human-readble name of state */
+static inline char *
+batchState2String(batch_state_t state) {
+ switch(state) {
+ case BATCH_STATE_RDY:
+ return "BATCH_STATE_RDY";
+ case BATCH_STATE_BAD:
+ return "BATCH_STATE_BAD";
+ case BATCH_STATE_SUB:
+ return "BATCH_STATE_SUB";
+ case BATCH_STATE_COMM:
+ return "BATCH_STATE_COMM";
+ case BATCH_STATE_DISC:
+ return "BATCH_STATE_DISC";
+ }
+ return "ERROR, batch state not known!";
+}
#endif /* #ifndef BATCH_H_INCLUDED */
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
index ab9fb738..2279856e 100644
--- a/runtime/rsyslog.h
+++ b/runtime/rsyslog.h
@@ -412,7 +412,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_RSCORE_TOO_OLD = -2120, /**< rsyslog core is too old for ... (eg this plugin) */
RS_RET_DEFER_COMMIT = -2121, /**< output plugin status: not yet committed (an OK state!) */
RS_RET_PREVIOUS_COMMITTED = -2122, /**< output plugin status: previous record was committed (an OK state!) */
- RS_RET_ACTION_FAILED = -2123, /**< action failed and is now suspended (consider this permanent for the time being) */
+ RS_RET_ACTION_FAILED = -2123, /**< action failed and is now suspended */
RS_RET_NONFATAL_CONFIG_ERR = -2124, /**< non-fatal error during config processing */
RS_RET_NON_SIZELIMITCMD = -2125, /**< size limit for file defined, but no size limit command given */
RS_RET_SIZELIMITCMD_DIDNT_RESOLVE = -2126, /**< size limit command did not resolve situation */
diff --git a/runtime/rule.c b/runtime/rule.c
index c3c974bf..42773768 100644
--- a/runtime/rule.c
+++ b/runtime/rule.c
@@ -99,29 +99,9 @@ DEFFUNC_llExecFunc(processBatchDoActions)
action_t *pAction = (action_t*) pData;
batch_t *pBatch = (batch_t*) pParam;
- assert(pAction != NULL);
-
-#warning execonly when prev suspended functionality missing!
-#if 0 // TODO: move this to the action object
- if((pAction->bExecWhenPrevSusp == 1) && (pDoActData->bPrevWasSuspended == 0)) {
- dbgprintf("not calling action because the previous one is not suspended\n");
- ABORT_FINALIZE(RS_RET_OK);
- }
-#endif
-
+ DBGPRINTF("Processing next action\n");
iRetMod = pAction->submitToActQ(pAction, pBatch);
-#if 0 // TODO: this must be done inside the action as well!
- if(iRetMod == RS_RET_DISCARDMSG) {
- ABORT_FINALIZE(RS_RET_DISCARDMSG);
- } else if(iRetMod == RS_RET_SUSPENDED) {
- /* indicate suspension for next module to be called */
- pDoActData->bPrevWasSuspended = 1;
- } else {
- pDoActData->bPrevWasSuspended = 0;
- }
-#endif
-
RETiRet;
}
@@ -291,11 +271,15 @@ processBatch(rule_t *pThis, batch_t *pBatch)
ISOBJ_TYPE_assert(pThis, rule);
assert(pBatch != NULL);
- /* first check the filters... */
+ /* first check the filters and reset status variables */
for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) {
CHKiRet(shouldProcessThisMessage(pThis, (msg_t*)(pBatch->pElem[i].pUsrp),
&(pBatch->pElem[i].bFilterOK)));
// TODO: really abort on error? 2010-06-10
+ if(pBatch->pElem[i].bFilterOK) {
+ /* re-init only when actually needed (cache write cost!) */
+ pBatch->pElem[i].bPrevWasSuspended = 0;
+ }
}
CHKiRet(llExecFunc(&pThis->llActList, processBatchDoActions, pBatch));
diff --git a/runtime/ruleset.c b/runtime/ruleset.c
index 8d6a1c2f..df7f8daa 100644
--- a/runtime/ruleset.c
+++ b/runtime/ruleset.c
@@ -146,6 +146,7 @@ DEFFUNC_llExecFunc(processBatchDoRules)
{
rsRetVal iRet;
ISOBJ_TYPE_assert(pData, rule);
+ dbgprintf("Processing next rule\n");
iRet = rule.ProcessBatch((rule_t*) pData, (batch_t*) pParam);
dbgprintf("ruleset: get iRet %d from rule.ProcessMsg()\n", iRet);
return iRet;