summaryrefslogtreecommitdiffstats
path: root/queue.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-13 17:46:44 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-13 17:46:44 +0000
commit30d11e969bb2c99c4401953437eef1ff3fe32234 (patch)
tree45fb97a7886095333288f11d7be17aa43cff02ed /queue.c
parent11044fe37ca36ae69112de3f8d1a9b6c48926334 (diff)
downloadrsyslog-30d11e969bb2c99c4401953437eef1ff3fe32234.tar.gz
rsyslog-30d11e969bb2c99c4401953437eef1ff3fe32234.tar.xz
rsyslog-30d11e969bb2c99c4401953437eef1ff3fe32234.zip
changed queue shutdown procedure a bit - stage work for queue shutdown
timeout setting
Diffstat (limited to 'queue.c')
-rw-r--r--queue.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/queue.c b/queue.c
index e3f10078..31d2d711 100644
--- a/queue.c
+++ b/queue.c
@@ -749,8 +749,6 @@ static rsRetVal queuePersist(queue_t *pThis)
size_t lenQIFNam;
assert(pThis != NULL);
- if(pThis->qType != QUEUETYPE_DISK)
- ABORT_FINALIZE(RS_RET_NOT_IMPLEMENTED); /* TODO: later... */
dbgprintf("Queue 0x%lx: persisting queue to disk, %d entries...\n", queueGetID(pThis), pThis->iQueueSize);
/* Construct file name */
@@ -766,6 +764,9 @@ static rsRetVal queuePersist(queue_t *pThis)
FINALIZE; /* nothing left to do, so be happy */
}
+ if(pThis->qType != QUEUETYPE_DISK)
+ ABORT_FINALIZE(RS_RET_NOT_IMPLEMENTED); /* TODO: later... */
+
CHKiRet(strmConstruct(&psQIF));
CHKiRet(strmSetDir(psQIF, glblGetWorkDir(), strlen((char*)glblGetWorkDir())));
CHKiRet(strmSettOperationsMode(psQIF, STREAMMODE_WRITE));
@@ -816,9 +817,7 @@ rsRetVal queueChkPersist(queue_t *pThis)
ISOBJ_TYPE_assert(pThis, queue);
-dbgprintf("chkPersist: PersUpdCnt %d, UpdsSincePers %d\n", pThis->iPersistUpdCnt, pThis->iUpdsSincePersist);
if(pThis->iPersistUpdCnt && ++pThis->iUpdsSincePersist >= pThis->iPersistUpdCnt) {
-dbgprintf("persistintg queue info!\n");
queuePersist(pThis);
pThis->iUpdsSincePersist = 0;
}
@@ -841,11 +840,9 @@ rsRetVal queueDestruct(queue_t *pThis)
pThis->pWrkThrds = NULL;
}
- /* now check if we need to persist the queue */
- if(pThis->bImmediateShutdown) {
- CHKiRet_Hdlr(queuePersist(pThis)) {
- dbgprintf("Queue 0x%lx: error %d persisting queue - data lost!\n", (unsigned long) pThis, iRet);
- }
+ /* persist the queue (we always do that - queuePersits() does cleanup it the queue is empty) */
+ CHKiRet_Hdlr(queuePersist(pThis)) {
+ dbgprintf("Queue 0x%lx: error %d persisting queue - data lost!\n", (unsigned long) pThis, iRet);
}
/* ... then free resources */