Fix infinite loop

This commit is contained in:
Quentin 2019-09-16 16:21:56 +02:00
parent 79d5e665db
commit ad0b9a2c25
2 changed files with 13 additions and 6 deletions

View file

@ -3,7 +3,7 @@ library(sqldf)
library(plyr)
library(cowplot)
thunder_ms <- read.csv("thunder_configure_8.csv")
thunder_ms <- read.csv("thunder_configure_10.csv")
thunder_ms <- sqldf("select run,jmax,links,latency, CAST(latency as real) / 1000. as lat_ms from thunder_ms")
thunder_ms$links <- as.factor(thunder_ms$links)
@ -30,7 +30,7 @@ v2 <- ggplot(data = thunder_rcv, aes(x = jmax, y=dlv, fill=links)) +
xlab("max allowed jitter") +
theme_classic()
thunder_bw <- read.csv("thunder_configure_8_bw.csv")
thunder_bw <- read.csv("thunder_configure_10_bw.csv")
thunder_bw <- sqldf("select run,jmax,links,udp_sent,udp_rcv,cells_sent,cells_rcv,1.0*cells_sent/udp_sent as sent_ratio,1.0*cells_rcv/udp_rcv as rcv_ratio from thunder_bw where udp_sent > 4000")
thunder_bw$jmax <- as.factor(thunder_bw$jmax)
thunder_bw$links <- as.factor(thunder_bw$links)

View file

@ -89,7 +89,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;
int64_t protect = thunderc->total_links;
do {
// 1. We choose the link
if (cat->socklist->len == 0) {
@ -97,12 +97,18 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu
break;
}
int64_t protect2 = thunderc->total_links;
to_fdinfo = NULL;
do {
thunderc->selected_link = (thunderc->selected_link + 1) % thunderc->total_links;
sprintf(url, "tcp:write:127.0.0.1:%d", 7500 + thunderc->selected_link);
to_fdinfo = evt_core_get_from_url (ctx, url);
} while (to_fdinfo == NULL);
} while (to_fdinfo == NULL && --protect2 >= 0);
if (protect2 < 0) {
fprintf(stderr, " [algo_thunder] scheduler/no link available\n");
goto schedule_release;
}
//printf("URL %s has been retained\n", url);
// 2. We create the packet template
@ -140,9 +146,9 @@ 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) && protect-- > 0);
} while (is_blacklisted (thunderc, thunderc->selected_link) && --protect >= 0);
if (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=%ld, rcved=%ld\n", i, thunderc->blacklisted[i], thunderc->received_pkts_on_link[i]);
@ -152,6 +158,7 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu
if (ctx->verbose > 1) fprintf(stderr, " [algo_thunder] Packets sent\n");
schedule_release:
// Release the buffer
mv_buffer_rtof (&app_ctx->br, fdinfo);