]> git.sesse.net Git - greproxy/commitdiff
Count reorders somewhat differently.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 14 Feb 2015 11:33:52 +0000 (12:33 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 14 Feb 2015 11:33:52 +0000 (12:33 +0100)
reorderer.cpp

index 2374ffd9dc5f3930b6d72093d9d7394fe71c68e7..c2823e5254c94a85c7201d61efbb613d27d88073 100644 (file)
@@ -66,6 +66,8 @@ void Reorderer::send_packet(uint16_t proto, const string& data, int seq)
        packet.ts = now;
        packet_buffer.push(packet);
 
+       bool did_reorder = false;
+
        while (!packet_buffer.empty() &&
               (last_seq == -1 || packet_buffer.top().seq <= last_seq + 1)) {
                int front_seq = packet_buffer.top().seq;
@@ -87,13 +89,17 @@ void Reorderer::send_packet(uint16_t proto, const string& data, int seq)
                last_seq = front_seq;
                last_sent_packet = now;
                if (!packet_buffer.empty()) {
-                       ++num_reorders;
+                       did_reorder = true;
                        if (!silence) {
                                printf("Reordering with packet buffer size %d: seq=%d new_front_seq=%d\n", int(packet_buffer.size()), front_seq, packet_buffer.top().seq);
                                silence = true;
                        }
                }
        }
+
+       if (did_reorder) {
+               ++num_reorders;
+       }
 }
 
 void Reorderer::check_ts_discontinuity(uint16_t proto, const string &data, bool silence)