diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-07 17:59:56 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-07 17:59:56 +0000 |
commit | 18e4228e63f729ca6db2c0c40d8d2db7813bbf34 (patch) | |
tree | a730245d93d843078bfb49a8004c5bd12fe6e5da /queue.c | |
parent | 571d21a33a46707deabc80769b4c8cb7d0f7c161 (diff) | |
download | rsyslog-18e4228e63f729ca6db2c0c40d8d2db7813bbf34.tar.gz rsyslog-18e4228e63f729ca6db2c0c40d8d2db7813bbf34.tar.bz2 rsyslog-18e4228e63f729ca6db2c0c40d8d2db7813bbf34.zip |
worked a bit more on the queue, disk dequeing part (not complete yet)
Diffstat (limited to 'queue.c')
-rw-r--r-- | queue.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -271,6 +271,7 @@ static rsRetVal qDiskReadChar(queueFileDescription_t *pFile, uchar *pC) assert(pFile != NULL); assert(pC != NULL); +dbgprintf("qDiskRead index %d, max %d\n", pFile->iBufPtr, pFile->iBufPtrMax); if(pFile->pIOBuf == NULL) { /* TODO: maybe we should move that to file open... */ if((pFile->pIOBuf = (uchar*) malloc(sizeof(uchar) * qFILE_IOBUF_SIZE )) == NULL) ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); @@ -287,7 +288,7 @@ static rsRetVal qDiskReadChar(queueFileDescription_t *pFile, uchar *pC) if(pFile->iBufPtr >= pFile->iBufPtrMax) { /* read */ pFile->iBufPtrMax = read(pFile->fd, pFile->pIOBuf, qFILE_IOBUF_SIZE); - dbgprintf("Read %d bytes from file %d\n", pFile->iBufPtrMax, pFile->fd); + dbgprintf("qDiskReadChar read %d bytes from file %d\n", pFile->iBufPtrMax, pFile->fd); if(pFile->iBufPtrMax == 0) ABORT_FINALIZE(RS_RET_EOF); else if(pFile->iBufPtrMax < 0) @@ -443,11 +444,20 @@ static rsRetVal qDelDisk(queue_t *pThis, void **ppUsr) CHKiRet(qDiskOpenFile(pThis, &pThis->tVars.disk.fRead, O_RDONLY, 0600)); // TODO: open modes! /* de-serialize object from file */ +retry: serialStore.pUsr = &pThis->tVars.disk.fRead; serialStore.funcGetChar = (rsRetVal (*)(void*, uchar*)) qDiskReadChar; serialStore.funcUngetChar = (rsRetVal (*)(void*, uchar)) qDiskUnreadChar; - CHKiRet(objDeserialize((void*) &pMsg, objMsg, &serialStore)); - + iRet= objDeserialize((void*) &pMsg, objMsg, &serialStore); + + if(iRet == RS_RET_OK) + ; + else if(iRet == RS_RET_EOF) { +dbgprintf("EOF!\n"); + CHKiRet(qDiskNextFile(pThis, &pThis->tVars.disk.fRead)); + goto retry; + } else + FINALIZE; /* switch to next file when EOF is reached. We may also delete the last file in that case. pThis->tVars.disk.fWrite.iCurrOffs += iWritten; if(pThis->tVars.disk.fWrite.iCurrOffs >= pThis->tVars.disk.iMaxFileSize) |