From 5bcab9639343d6b5f05fb65beacf186dfb650d6f Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 13 May 2019 16:34:22 +0200 Subject: [PATCH] Add buffer release for control packets (health) --- src/algo_rr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/algo_rr.c b/src/algo_rr.c index 5bbc8e4..82ece34 100644 --- a/src/algo_rr.c +++ b/src/algo_rr.c @@ -174,9 +174,8 @@ void rr_pkt_manage_links(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinf struct rr_ctx* rr = app_ctx->misc; assert(bp->ip.ap.headers.cmd == CMD_HEALTH); - if (ring_le(app_ctx->health_id, rr->health_id_late)) { - return; - } + + if (ring_le(bp->ip.ap.health.id, rr->health_id_late)) goto release; int64_t timeout = rr->mjit - (int64_t) bp->ip.ap.content.health.deltat; if (timeout <= 0) timeout = 0; @@ -188,6 +187,9 @@ void rr_pkt_manage_links(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinf rr->wait[idx].algo = app_ctx; set_timeout (ctx, timeout, &rr->wait[idx], on_timeout_health); + +release: + mv_buffer_rtof(app_ctx, fdinfo); } void rr_pkt_unroll(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx) {