Commit 349b320d authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Proper cleanup for packetDeliveryStore.

parent 70d02f04
Pipeline #1717 passed with stages
in 1 minute and 35 seconds
......@@ -103,6 +103,20 @@ bool PrrtPacketDeliveryStore_insert(PrrtPacketDeliveryStore *q, PrrtPacket *pack
}
bool PrrtPacketDeliveryStore_destroy(PrrtPacketDeliveryStore *q) {
List *packetList = List_create();
BPTree_get_range(q->tree, packetList, 0, (prrtSequenceNumber_t) (SEQNO_SPACE - 1));
while (List_count(packetList) > 0) {
PrrtPacket *block = List_shift(packetList);
q->tree = BPTree_delete(q->tree, block->sequenceNumber);
PrrtPacket_destroy(block);
}
List_destroy(packetList);
if(q->tree != NULL) {
q->tree = BPTree_destroy(q->tree);
}
pthread_mutex_destroy(&q->lock);
pthread_cond_destroy(&q->wait_for_data);
free(q);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment