From 53fe3801e14a1edbf936c12ceb2a5f50cdacfb25 Mon Sep 17 00:00:00 2001 From: Quentin Date: Sat, 14 Sep 2019 15:44:30 +0200 Subject: [PATCH] Reset when links are blocked --- src/algo_thunder.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/algo_thunder.c b/src/algo_thunder.c index c5ee743..58edda4 100644 --- a/src/algo_thunder.c +++ b/src/algo_thunder.c @@ -107,6 +107,7 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu struct evt_core_fdinfo *to_fdinfo = NULL; struct evt_core_cat* cat = evt_core_get_from_cat (ctx, "tcp-write"); + uint8_t protect = thunderc->total_links; do { // 1. We choose the link if (cat->socklist->len == 0) { @@ -152,7 +153,15 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu } main_on_tcp_write(ctx, to_fdinfo); - } while (is_blacklisted (thunderc, thunderc->selected_link)); + } while (is_blacklisted (thunderc, thunderc->selected_link) && protect-- > 0); + + if (protect == 0) { + fprintf(stderr, "all links were blacklisted, resetting\n"); + for (int i = 0; i < thunderc->total_links; i++) { + fprintf(stderr, " link=%d, blacklisted=%d, rcved=%d\n", i, thunderc->blacklisted[i], thunderc->received_pkts_on_link[i]); + thunderc->received_pkts_on_link[i] = thunderc->blacklisted[i] + 1; + } + } if (ctx->verbose > 1) fprintf(stderr, " [algo_thunder] Packets sent\n");