summaryrefslogtreecommitdiffstats
path: root/queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'queue.c')
-rw-r--r--queue.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/queue.c b/queue.c
index 8010a45d..3559835b 100644
--- a/queue.c
+++ b/queue.c
@@ -1051,6 +1051,8 @@ queueEnqObj(queue_t *pThis, void *pUsr)
int iCancelStateSave;
int i;
struct timespec t;
+ int iSeverity = 8;
+ rsRetVal iRetLocal;
assert(pThis != NULL);
@@ -1064,13 +1066,28 @@ queueEnqObj(queue_t *pThis, void *pUsr)
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave);
pthread_mutex_lock(pThis->mut);
}
+
+ if(pThis->iQueueSize >= pThis->iDiscardMrk) {
+ iRetLocal = objGetSeverity(pUsr, &iSeverity);
+ if(iRetLocal == RS_RET_OK && iSeverity >= pThis->iDiscardSeverity) {
+ dbgprintf("Queue 0x%lx: queue nearly full (%d entries), discarded severity %d message\n",
+ queueGetID(pThis), pThis->iQueueSize, iSeverity);
+ objDestruct(pUsr);
+ ABORT_FINALIZE(RS_RET_QUEUE_FULL);
+ } else {
+ dbgprintf("Queue 0x%lx: queue nearly full (%d entries), but could not drop msg "
+ "(iRet: %d, severity %d)\n", queueGetID(pThis), pThis->iQueueSize,
+ iRetLocal, iSeverity);
+ }
+ }
+
while(pThis->iQueueSize >= pThis->iMaxQueueSize) {
- dbgprintf("Queue 0x%lx: enqueueMsg: queue FULL - waiting to drain.\n", (unsigned long) pThis);
+ dbgprintf("Queue 0x%lx: enqueueMsg: queue FULL - waiting to drain.\n", queueGetID(pThis));
queueTimeoutComp(&t, pThis->toEnq);
if(pthread_cond_timedwait (pThis->notFull,
pThis->mut, &t) != 0) {
- dbgprintf("Queue 0x%lx: enqueueMsg: cond timeout, dropping message!\n", (unsigned long) pThis);
+ dbgprintf("Queue 0x%lx: enqueueMsg: cond timeout, dropping message!\n", queueGetID(pThis));
objDestruct(pUsr);
ABORT_FINALIZE(RS_RET_QUEUE_FULL);
}