summaryrefslogtreecommitdiffstats
path: root/queue.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-12 13:58:49 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-12 13:58:49 +0000
commit2d9239beca678e35b8dc6e09e4add721052bfcb8 (patch)
tree96689305884dae4ff75bea6324b353c4f5756ee9 /queue.c
parentbc846dc0bddbf0f95c1354927adcb5daaf41ef4c (diff)
downloadrsyslog-2d9239beca678e35b8dc6e09e4add721052bfcb8.tar.gz
rsyslog-2d9239beca678e35b8dc6e09e4add721052bfcb8.tar.xz
rsyslog-2d9239beca678e35b8dc6e09e4add721052bfcb8.zip
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
Diffstat (limited to 'queue.c')
-rw-r--r--queue.c29
1 files changed, 16 insertions, 13 deletions
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;