From 879dca9a7625746e6d61310adf3c56578d87372a Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 23 Mar 2018 11:53:24 +0100 Subject: [PATCH] BUG/MINOR: spoe: Don't forget to decrement fpa when a processing is interrupted In async or pipelining mode, we count the number of NOTIFY frames sent waiting for their corresponding ACK frames. This is a way to evaluate the "load" of a SPOE applet. For pipelining mode, it is easy to make the link between a NOTIFY frame and its ACK one, because exchanges are done using the same TCP connection. For async mode, it is harder because a ACK frame can be received on another connection than the one sending the NOTIFY frame. So to decrement the fpa of the right applet, we need to keep it in the SPOE context. Most of time, it works expect when the processing is interrupted by the stream, because of a timeout. This patch fixes this issue. If a SPOE applet is still link to a SPOE context when the processing is interrupted by the stream, the applet's fpa is decremented. This is only done for unfragmented frames. --- src/flt_spoe.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/flt_spoe.c b/src/flt_spoe.c index befa611a0..5767dfe62 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -2456,9 +2456,13 @@ spoe_stop_processing(struct spoe_agent *agent, struct spoe_context *ctx) if (!(ctx->flags & SPOE_CTX_FL_PROCESS)) return; - if (sa && sa->frag_ctx.ctx == ctx) { - sa->frag_ctx.ctx = NULL; - spoe_wakeup_appctx(sa->owner); + if (sa) { + if (sa->frag_ctx.ctx == ctx) { + sa->frag_ctx.ctx = NULL; + spoe_wakeup_appctx(sa->owner); + } + else + sa->cur_fpa--; } /* Reset the flag to allow next processing */