Commit 394d746c authored by Joanne Hugé's avatar Joanne Hugé

Fix lost packets not being properly computed

parent a44206de
......@@ -142,6 +142,8 @@ static void *packet_receiving_thread(void *p) {
clock_gettime(CLOCK_MONOTONIC, &current);
current_packet_id = atoi(param->stats.packet_info.data);
// If this is not the first received packet
if (stats->packets_received) {
......@@ -150,8 +152,7 @@ static void *packet_receiving_thread(void *p) {
stats->max_interval = diff > stats->max_interval ? diff : stats->max_interval;
// Check if packets were lost
current_packet_id = atoi(param->stats.packet_info.data);
param->stats.lost_packets += (current_packet_id - prev_packet_id) % 1000 - 1;
param->stats.lost_packets += (current_packet_id - prev_packet_id - 1) % 1000;
if(enable_histograms) {
dist_to_interval = (((int64_t)diff) - param->interval) / 1000;
......
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