Reset when links are blocked

This commit is contained in:
Quentin 2019-09-14 15:44:30 +02:00
parent 91ca55973d
commit 53fe3801e1

View file

@ -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_fdinfo *to_fdinfo = NULL;
struct evt_core_cat* cat = evt_core_get_from_cat (ctx, "tcp-write"); struct evt_core_cat* cat = evt_core_get_from_cat (ctx, "tcp-write");
uint8_t protect = thunderc->total_links;
do { do {
// 1. We choose the link // 1. We choose the link
if (cat->socklist->len == 0) { 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); 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"); if (ctx->verbose > 1) fprintf(stderr, " [algo_thunder] Packets sent\n");