From 94e3ae872f381c8f90628858339645cd4fee2264 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 19 Mar 2019 21:06:01 +0100 Subject: [PATCH] Add a check --- src/algo_rr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/algo_rr.c b/src/algo_rr.c index 10fa76e..dbef6d8 100644 --- a/src/algo_rr.c +++ b/src/algo_rr.c @@ -170,6 +170,7 @@ void rr_deliver(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct if (rr->wait[idx_real].on) { rr->wait[idx_real].on = 0; evt_core_rm_fd (ctx, rr->wait[idx_real].timer_fd); + printf("Removed timer for packet %d\n",bp->ip.ap.str.id); } // 2. We free the buffer if it's a control packet and quit @@ -368,8 +369,11 @@ int rr_on_timer(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) { struct rr_ctx* rr = app_ctx->misc; struct waited_pkt* pkt = fdinfo->other; - pkt->on = 0; evt_core_rm_fd(ctx, fdinfo->fd); + if (ring_lt(pkt->id, rr->recv_id)) return 1; + + printf("Timer reached for packet %d\n", pkt->id); + pkt->on = 0; //rr->remote_links &= 0xffff ^ 1 << pkt->link_num; rr->recv_id = pkt->id;