Commit d7689b13 authored by Andreas Schmidt's avatar Andreas Schmidt

Fix maximum value vs. value count for SEQNO_SPACE and TIMESTAMP_SPACE.

parent 54e839ad
Pipeline #2806 failed with stages
in 1 minute and 11 seconds
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
#define MAX_PAYLOAD_LENGTH 65507 // maximum UDP packet length (2^16 - 1 - 8 (UDP Header) - 20 (IP Header)) #define MAX_PAYLOAD_LENGTH 65507 // maximum UDP packet length (2^16 - 1 - 8 (UDP Header) - 20 (IP Header))
#define SEQNO_SPACE UINT16_MAX // 2**16 as seqno is uint16_t #define SEQNO_SPACE (UINT16_MAX+1) // 2**16 as seqno is uint16_t
#define TIMESTAMP_SPACE UINT32_MAX #define TIMESTAMP_SPACE (UINT32_MAX+1)
#define GF_BITS 8 #define GF_BITS 8
......
...@@ -127,7 +127,7 @@ PrrtPacket *PrrtPacketDeliveryStore_get_packet(PrrtPacketDeliveryStore *store, p ...@@ -127,7 +127,7 @@ PrrtPacket *PrrtPacketDeliveryStore_get_packet(PrrtPacketDeliveryStore *store, p
check(pthread_mutex_lock(&store->lock) == EXIT_SUCCESS, "Lock failed."); check(pthread_mutex_lock(&store->lock) == EXIT_SUCCESS, "Lock failed.");
if (start > stop) { if (start > stop) {
packet = BPTree_get_first_in_range(store->tree, (BPTreeKey_t) start, TIMESTAMP_SPACE-1); packet = BPTree_get_first_in_range(store->tree, (BPTreeKey_t) start, TIMESTAMP_SPACE - 1);
if (packet == NULL) { if (packet == NULL) {
packet = BPTree_get_first_in_range(store->tree, 0, (BPTreeKey_t) stop); packet = BPTree_get_first_in_range(store->tree, 0, (BPTreeKey_t) stop);
} }
...@@ -173,7 +173,7 @@ void PrrtPacketDeliveryStore_cleanup(PrrtPacketDeliveryStore *store, prrtTimesta ...@@ -173,7 +173,7 @@ void PrrtPacketDeliveryStore_cleanup(PrrtPacketDeliveryStore *store, prrtTimesta
BPTree_get_range(store->tree, packetList, now - TIMESTAMP_SPACE/2, now); BPTree_get_range(store->tree, packetList, now - TIMESTAMP_SPACE/2, now);
} else { } else {
BPTree_get_range(store->tree, packetList, 0, now); BPTree_get_range(store->tree, packetList, 0, now);
BPTree_get_range(store->tree, packetList, now + TIMESTAMP_SPACE/2, TIMESTAMP_SPACE); BPTree_get_range(store->tree, packetList, now + TIMESTAMP_SPACE/2, TIMESTAMP_SPACE - 1);
} }
while (List_count(packetList) > 0) { while (List_count(packetList) > 0) {
PrrtPacket *packet = List_shift(packetList); PrrtPacket *packet = List_shift(packetList);
......
...@@ -91,7 +91,7 @@ bool PrrtRepairBlockStore_expire_block_range(PrrtRepairBlockStore *store, prrtSe ...@@ -91,7 +91,7 @@ bool PrrtRepairBlockStore_expire_block_range(PrrtRepairBlockStore *store, prrtSe
List* blocks = List_create(); List* blocks = List_create();
if(start > stop) { if(start > stop) {
BPTree_get_range(store->blockTree, blocks, start, (prrtSequenceNumber_t) (SEQNO_SPACE-1)); BPTree_get_range(store->blockTree, blocks, start, (prrtSequenceNumber_t) (SEQNO_SPACE - 1));
BPTree_get_range(store->blockTree, blocks, 0, stop); BPTree_get_range(store->blockTree, blocks, 0, stop);
} else { } else {
BPTree_get_range(store->blockTree, blocks, start, stop); BPTree_get_range(store->blockTree, blocks, start, stop);
......
...@@ -13,7 +13,7 @@ PrrtChannelStateInformation * PrrtChannelStateInformation_create() ...@@ -13,7 +13,7 @@ PrrtChannelStateInformation * PrrtChannelStateInformation_create()
check(pthread_mutex_init(&csi->lock, NULL) == 0, "Mutex init failed."); check(pthread_mutex_init(&csi->lock, NULL) == 0, "Mutex init failed.");
csi->rtprop = TIMESTAMP_SPACE; csi->rtprop = TIMESTAMP_SPACE - 1;
csi->rtprop_filter_length_us = 2 * 1000 * 1000; // 2 seconds csi->rtprop_filter_length_us = 2 * 1000 * 1000; // 2 seconds
csi->deliveryRate = 0; csi->deliveryRate = 0;
......
...@@ -32,6 +32,6 @@ int64_t PrrtTimestamp_cmp(prrtTimestamp_t a, prrtTimestamp_t b) { ...@@ -32,6 +32,6 @@ int64_t PrrtTimestamp_cmp(prrtTimestamp_t a, prrtTimestamp_t b) {
if (diff < TIMESTAMP_SPACE / 2) { if (diff < TIMESTAMP_SPACE / 2) {
return diff; return diff;
} else { } else {
return ((int64_t)diff) - ((int64_t)(TIMESTAMP_SPACE) + 1); return ((int64_t)diff) - ((int64_t)(TIMESTAMP_SPACE));
} }
} }
\ No newline at end of file
Markdown is supported
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