Fix bogus queue assert firing on failed connection

This commit is contained in:
Cameron Gutman 2017-05-21 10:37:34 -07:00
parent eaf3355c96
commit 109472e4ab
2 changed files with 3 additions and 1 deletions

View File

@ -2,7 +2,7 @@
// Destroy the linked blocking queue and associated mutex and event // Destroy the linked blocking queue and associated mutex and event
PLINKED_BLOCKING_QUEUE_ENTRY LbqDestroyLinkedBlockingQueue(PLINKED_BLOCKING_QUEUE queueHead) { PLINKED_BLOCKING_QUEUE_ENTRY LbqDestroyLinkedBlockingQueue(PLINKED_BLOCKING_QUEUE queueHead) {
LC_ASSERT(queueHead->shutdown); LC_ASSERT(queueHead->shutdown || queueHead->lifetimeSize == 0);
PltDeleteMutex(&queueHead->mutex); PltDeleteMutex(&queueHead->mutex);
PltCloseEvent(&queueHead->containsDataEvent); PltCloseEvent(&queueHead->containsDataEvent);
@ -87,6 +87,7 @@ int LbqOfferQueueItem(PLINKED_BLOCKING_QUEUE queueHead, void* data, PLINKED_BLOC
} }
queueHead->currentSize++; queueHead->currentSize++;
queueHead->lifetimeSize++;
PltUnlockMutex(&queueHead->mutex); PltUnlockMutex(&queueHead->mutex);

View File

@ -20,6 +20,7 @@ typedef struct _LINKED_BLOCKING_QUEUE {
int sizeBound; int sizeBound;
int currentSize; int currentSize;
int shutdown; int shutdown;
int lifetimeSize;
PLINKED_BLOCKING_QUEUE_ENTRY head; PLINKED_BLOCKING_QUEUE_ENTRY head;
PLINKED_BLOCKING_QUEUE_ENTRY tail; PLINKED_BLOCKING_QUEUE_ENTRY tail;
} LINKED_BLOCKING_QUEUE, *PLINKED_BLOCKING_QUEUE; } LINKED_BLOCKING_QUEUE, *PLINKED_BLOCKING_QUEUE;