diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-11-05 12:59:08 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-11-05 12:59:08 +0100 |
commit | afe2f1dc5f46f51c92cefecd42cb7a523f0c8a6c (patch) | |
tree | 600a7da79bebe2dd5ad4179c95acd644df442e3e | |
parent | 9b2e8c53fd08950eb397de0aedbc40e49e5a701a (diff) | |
download | rsyslog-afe2f1dc5f46f51c92cefecd42cb7a523f0c8a6c.tar.gz rsyslog-afe2f1dc5f46f51c92cefecd42cb7a523f0c8a6c.tar.bz2 rsyslog-afe2f1dc5f46f51c92cefecd42cb7a523f0c8a6c.zip |
refactor: simplify code path
-rw-r--r-- | action.c | 40 |
1 files changed, 14 insertions, 26 deletions
@@ -14,7 +14,6 @@ * * if set iExecEveryNthOccur > 1 || iSecsExecOnceInterval * - doSubmitToActionQComplexBatch - * - doActionCallAction * handles mark message reduction, but in essence calls * - actionWriteToAction * - qqueueEnqObj @@ -1281,30 +1280,6 @@ finalize_it: } -/* helper to actonCallAction, mostly needed because of this damn - * pthread_cleanup_push() POSIX macro... - */ -static inline rsRetVal -doActionCallAction(action_t *pAction, wti_t *pWti, msg_t *pMsg) -{ - DEFiRet; - - pAction->tActNow = -1; /* we do not yet know our current time (clear prev. value) */ - - /* don't output marks to recently written outputs */ - if(pAction->bWriteAllMarkMsgs == RSFALSE - && (pMsg->msgFlags & MARK) && (getActNow(pAction) - pAction->f_time) < MarkInterval / 2) { - ABORT_FINALIZE(RS_RET_OK); - } - - /* call the output driver */ - iRet = actionWriteToAction(pAction, pMsg, pWti); - -finalize_it: - RETiRet; -} - - /* helper to activateActions, it activates a specific action. */ DEFFUNC_llExecFunc(doActivateActions) @@ -1441,10 +1416,23 @@ doSubmitToActionQComplexBatch(action_t *pAction, wti_t *pWti, msg_t *pMsg) pthread_cleanup_push(mutexCancelCleanup, &pAction->mutAction); DBGPRINTF("Called action %p (complex case), logging to %s\n", pAction, module.GetStateName(pAction->pMod)); - doActionCallAction(pAction, pWti, pMsg); + + pAction->tActNow = -1; /* we do not yet know our current time (clear prev. value) */ + // TODO: can we optimize the "now" handling again (was batch, I guess...)? + + /* don't output marks to recently written outputs */ + if(pAction->bWriteAllMarkMsgs == RSFALSE + && (pMsg->msgFlags & MARK) && (getActNow(pAction) - pAction->f_time) < MarkInterval / 2) { + ABORT_FINALIZE(RS_RET_OK); + } + + /* call the output driver */ + iRet = actionWriteToAction(pAction, pMsg, pWti); + d_pthread_mutex_unlock(&pAction->mutAction); pthread_cleanup_pop(0); /* remove mutex cleanup handler */ +finalize_it: RETiRet; } #pragma GCC diagnostic warning "-Wempty-body" |