From 2d9239beca678e35b8dc6e09e4add721052bfcb8 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 12 Feb 2008 13:58:49 +0000 Subject: bugfix: discard action and backup actions did not work due to problem in direct queue mode. Now fixed. Tracker was http://sourceforge.net/tracker/index.php?func=detail&aid=1886931&group_ id=123448&atid=696552 --- ChangeLog | 3 +++ action.c | 1 + omdiscard.c | 1 + queue.c | 29 ++++++++++++++++------------- syslogd.c | 8 ++++---- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6cdce39..fadf928c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,9 @@ Version 3.11.1 (rgerhards), 2008-02-12 Thanks to Anders Blomdell fro bringing this to our attention - somewhat improved performance of string buffers - fixed bug that caused invalid treatment of tabs (HT) in rsyslog.conf +- bugfix: setting for $EscapeCopntrolCharactersOnReceive was not + properly initialized +- clarified usage of space-cc property replacer option --------------------------------------------------------------------------- Version 3.11.0 (rgerhards), 2008-01-31 - implemented queued actions diff --git a/action.c b/action.c index 81cd45b2..5fab8ec6 100644 --- a/action.c +++ b/action.c @@ -520,6 +520,7 @@ actionWriteToAction(action_t *pAction) * So let's enqueue our message for execution. -- rgerhards, 2007-07-24 */ iRet = queueEnqObj(pAction->pQueue, (void*) MsgAddRef(pAction->f_pMsg)); +RUNLOG_VAR("%d", iRet); if(iRet == RS_RET_OK) pAction->f_prevcount = 0; /* message processed, so we start a new cycle */ diff --git a/omdiscard.c b/omdiscard.c index 26d5f3da..0f99b5fd 100644 --- a/omdiscard.c +++ b/omdiscard.c @@ -71,6 +71,7 @@ ENDtryResume BEGINdoAction CODESTARTdoAction + dbgprintf("\n"); iRet = RS_RET_DISCARDMSG; ENDdoAction diff --git a/queue.c b/queue.c index 03103b70..395f3430 100644 --- a/queue.c +++ b/queue.c @@ -890,19 +890,16 @@ static rsRetVal qDestructDirect(queue_t __attribute__((unused)) *pThis) static rsRetVal qAddDirect(queue_t *pThis, void* pUsr) { DEFiRet; - rsRetVal iRetLocal; ASSERT(pThis != NULL); /* calling the consumer is quite different here than it is from a worker thread */ - iRetLocal = pThis->pConsumer(pThis->pUsr, pUsr); - if(iRetLocal != RS_RET_OK) { - dbgoprint((obj_t*) pThis, "Consumer returned iRet %d\n", iRetLocal); - } - --pThis->iQueueSize; /* this is kind of a hack, but its the smartest thing we can do given - * the somewhat astonishing fact that this queue type does not actually - * queue anything ;) - */ + /* we need to provide the consumer's return value back to the caller because in direct + * mode the consumer probably has a lot to convey (which get's lost in the other modes + * because they are asynchronous. But direct mode is deliberately synchronous. + * rgerhards, 2008-02-12 + */ + iRet = pThis->pConsumer(pThis->pUsr, pUsr); RETiRet; } @@ -963,18 +960,24 @@ queueGetUngottenObj(queue_t *pThis, obj_t **ppUsr) } -/* generic code to add a queue entry */ +/* generic code to add a queue entry + * We use some specific code to most efficiently support direct mode + * queues. This is justified in spite of the gain and the need to do some + * things truely different. -- rgerhards, 2008-02-12 + */ static rsRetVal queueAdd(queue_t *pThis, void *pUsr) { DEFiRet; ASSERT(pThis != NULL); - CHKiRet(pThis->qAdd(pThis, pUsr)); - ++pThis->iQueueSize; + CHKiRet(pThis->qAdd(pThis, pUsr)); - dbgoprint((obj_t*) pThis, "entry added, size now %d entries\n", pThis->iQueueSize); + if(pThis->qType != QUEUETYPE_DIRECT) { + ++pThis->iQueueSize; + dbgoprint((obj_t*) pThis, "entry added, size now %d entries\n", pThis->iQueueSize); + } finalize_it: RETiRet; diff --git a/syslogd.c b/syslogd.c index 5bccc738..6841a6a9 100644 --- a/syslogd.c +++ b/syslogd.c @@ -1645,12 +1645,12 @@ int shouldProcessThisMessage(selector_t *f, msg_t *pMsg) iRet = (iRet == 1) ? 0 : 1; if(Debug) { - printf("Filter: check for property '%s' (value '%s') ", + dbgprintf("Filter: check for property '%s' (value '%s') ", rsCStrGetSzStrNoNULL(f->f_filterData.prop.pCSPropName), pszPropVal); if(f->f_filterData.prop.isNegated) - printf("NOT "); - printf("%s '%s': %s\n", + dbgprintf("NOT "); + dbgprintf("%s '%s': %s\n", getFIOPName(f->f_filterData.prop.operation), rsCStrGetSzStrNoNULL(f->f_filterData.prop.pCSCompValue), iRet ? "TRUE" : "FALSE"); @@ -2893,7 +2893,7 @@ DEFFUNC_llExecFunc(dbgPrintInitInfoAction) { DEFiRet; iRet = actionDbgPrint((action_t*) pData); - printf("\n"); + dbgprintf("\n"); RETiRet; } -- cgit v1.2.3