summaryrefslogtreecommitdiffstats
path: root/action.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-29 09:13:59 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-29 09:13:59 +0000
commit33a8ec9855b7e7674ab2b1a6e4814b08652296de (patch)
treebb15bd7523a4b95075b7d2d5b92b42b844d5e562 /action.c
parent8b73362a4a88aaa3642db398d17e65eab871d9ed (diff)
downloadrsyslog-33a8ec9855b7e7674ab2b1a6e4814b08652296de.tar.gz
rsyslog-33a8ec9855b7e7674ab2b1a6e4814b08652296de.tar.xz
rsyslog-33a8ec9855b7e7674ab2b1a6e4814b08652296de.zip
- moved correct retry logic into action processing queue
- removed debugging support from sync class, debug class now provides much more
Diffstat (limited to 'action.c')
-rw-r--r--action.c41
1 files changed, 14 insertions, 27 deletions
diff --git a/action.c b/action.c
index a3cd9370..872c2085 100644
--- a/action.c
+++ b/action.c
@@ -127,8 +127,6 @@ actionConstructFinalize(action_t *pThis)
/* create queue */
RUNLOG_VAR("%d", ActionQueType);
CHKiRet(queueConstruct(&pThis->pQueue, ActionQueType, 1, 10, (rsRetVal (*)(void*,void*))actionCallDoAction));
-RUNLOG_VAR("%p", pThis->pQueue);
-RUNLOG_VAR("%x", pThis->pQueue->iObjCooCKiE );
/* ... set some properties ... */
@@ -270,20 +268,6 @@ rsRetVal actionDbgPrint(action_t *pThis)
}
-/* schedule the message for processing
- * rgerhards, 2008-01-28
- */
-rsRetVal
-actionDoAction(action_t *pAction)
-{
- DEFiRet;
-RUNLOG_VAR("%p", pAction->f_pMsg);
- ISOBJ_TYPE_assert(pAction->f_pMsg, Msg);
- iRet = queueEnqObj(pAction->pQueue, (void*) MsgAddRef(pAction->f_pMsg));
- RETiRet;
-}
-
-
/* call the DoAction output plugin entry point
* rgerhards, 2008-01-28
*/
@@ -306,8 +290,17 @@ actionCallDoAction(action_t *pAction, msg_t *pMsg)
do {
RUNLOG_STR("going into do_action call loop");
RUNLOG_VAR("%d", iRetries);
- /* call configured action */
- iRet = pAction->pMod->mod.om.doAction(pAction->ppMsgs, pAction->f_pMsg->msgFlags, pAction->pModData);
+ /* first check if we are suspended and, if so, retry */
+ if(actionIsSuspended(pAction)) {
+dbgprintf("action %p is suspended\n", pAction);
+ iRet = actionTryResume(pAction);
+ }
+
+ if(iRet == RS_RET_OK) {
+ /* call configured action */
+ iRet = pAction->pMod->mod.om.doAction(pAction->ppMsgs, pAction->f_pMsg->msgFlags, pAction->pModData);
+ }
+
RUNLOG_VAR("%d", iRet);
if(iRet == RS_RET_SUSPENDED) {
/* ok, this calls for our retry logic... */
@@ -342,6 +335,7 @@ finalize_it:
pAction->ppMsgs[i] = NULL;
}
}
+ MsgDestruct(&pMsg); /* we are now finished with the message */
RETiRet;
}
@@ -437,9 +431,9 @@ actionWriteToAction(action_t *pAction)
time(&pAction->f_time); /* we need this for message repeation processing */
/* When we reach this point, we have a valid, non-disabled action.
- * So let's execute it. -- rgerhards, 2007-07-24
+ * So let's enqueue our message for execution. -- rgerhards, 2007-07-24
*/
- iRet = actionDoAction(pAction);
+ iRet = queueEnqObj(pAction->pQueue, (void*) MsgAddRef(pAction->f_pMsg));
finalize_it:
if(pMsgSave != NULL) {
@@ -460,9 +454,6 @@ finalize_it:
}
-
-
-
/* call the configured action. Does all necessary housekeeping.
* rgerhards, 2007-08-01
*/
@@ -498,10 +489,6 @@ actionCallAction(action_t *pAction, msg_t *pMsg)
ABORT_FINALIZE(RS_RET_OK);
}
- if(actionIsSuspended(pAction)) {
- CHKiRet(actionTryResume(pAction));
- }
-
/* don't output marks to recently written files */
if ((pMsg->msgFlags & MARK) && (time(NULL) - pAction->f_time) < MarkInterval / 2) {
ABORT_FINALIZE(RS_RET_OK);