From f61148345eaf0de53deb6f85aa464812a7114ea9 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Fri, 30 Aug 2019 10:48:23 +0200 Subject: [PATCH] Fix out of order --- src/algo_thunder.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/algo_thunder.c b/src/algo_thunder.c index ab30314..40d273b 100644 --- a/src/algo_thunder.c +++ b/src/algo_thunder.c @@ -180,8 +180,11 @@ release: int is_in_order(struct thunder_ctx* thunderc, uint8_t link_id) { uint64_t ref = thunderc->received_pkts_on_link[link_id]; for (int i = 0; i < thunderc->total_links; i++) { - uint64_t expected = link_id > i ? ref - 1 : ref; - if (thunderc->received_pkts_on_link[i] > expected) return 0; + uint64_t expected = link_id >= i ? ref : ref - 1; + if (thunderc->received_pkts_on_link[i] > expected) { + printf("link_id=%d, i=%d, pkt_i=%ld, pkt_i_expected=%ld, pkt_link_id=%ld\n", link_id, i, thunderc->received_pkts_on_link[i], expected, ref); + return 0; + } } return 1; @@ -253,7 +256,7 @@ void classify(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct b if (timeout <= 0) { on_block(ctx, bi); - printf(" Missing Packet - Blocked link %d (expected: %ld, seen: %ld, )\n", i, expected, thunderc->received_pkts_on_link[i]); + printf(" Missing Packet - Blocked link %d (expected: %ld, seen: %ld)\n", i, expected, thunderc->received_pkts_on_link[i]); continue; }