Commit ff6388a4 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

RepairBlock store is cleaned.

parent 181e7c96
Pipeline #1482 passed with stages
in 2 minutes and 9 seconds
......@@ -126,7 +126,7 @@ static void handle_data_packet(PrrtSocket *sock_ptr, PrrtPacket *packet, struct
PrrtBlock *block = PrrtRepairBlockStore_get_block(sock_ptr->repairBlockStore, baseSequenceNumber);
if (block != NULL) {
check(PrrtBlock_insert_data_packet(block, reference), "Inserting failed");
check(PrrtBlock_insert_data_packet(block, reference), "Inserting failed: %d, %d", baseSequenceNumber, seqno);
decode_block(sock_ptr, block);
} else {
if (PrrtDataStore_insert(sock_ptr->dataPacketStore, reference) == false) {
......
......@@ -452,6 +452,11 @@ bool PrrtSocket_cleanup(PrrtSocket *socket) {
}
List_destroy(expired_packets);
}
if(socket->forwardPacketTable != NULL) {
prrtSequenceNumber_t current_start = socket->forwardPacketTable->start;
PrrtRepairBlockStore_expire_block_range(socket->repairBlockStore, (prrtSequenceNumber_t) (current_start - SEQNO_SPACE/2),
(prrtSequenceNumber_t) (current_start - 1));
}
}
return true;
}
......
......@@ -21,7 +21,7 @@ PrrtRepairBlockStore *PrrtRepairBlockStore_create(void)
bool PrrtRepairBlockStore_destroy(PrrtRepairBlockStore *store)
{
List *blockList = List_create();
BPTree_get_range(store->blockTree, blockList, 0, SEQNO_SPACE - 1);
BPTree_get_range(store->blockTree, blockList, 0, (prrtSequenceNumber_t) (SEQNO_SPACE - 1));
while (List_count(blockList) > 0) {
PrrtBlock *block = List_shift(blockList);
store->blockTree = BPTree_delete(store->blockTree, block->baseSequenceNumber);
......@@ -91,7 +91,7 @@ bool PrrtRepairBlockStore_expire_block_range(PrrtRepairBlockStore *store, prrtSe
List* blocks = List_create();
if(start > stop) {
BPTree_get_range(store->blockTree, blocks, start, SEQNO_SPACE-1);
BPTree_get_range(store->blockTree, blocks, start, (prrtSequenceNumber_t) (SEQNO_SPACE-1));
BPTree_get_range(store->blockTree, blocks, 0, stop);
} else {
BPTree_get_range(store->blockTree, blocks, start, stop);
......
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