From: Christopher Faulet Date: Tue, 10 Nov 2020 13:31:39 +0000 (+0100) Subject: MINOR: spoe: Don't close connection in sync mode on processing timeout X-Git-Tag: v2.1.11~55 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=d1b9abb7963c265617b3f7e923c316176605736b;p=haproxy-2.1.git MINOR: spoe: Don't close connection in sync mode on processing timeout In sync mode, if an applet receives a ack while the processing delay has already expired, there is not frame waiting for this ack. But there is no reason to close the connection in this case. The ack may be ignored and the connection may be reused to process another frame. The only reason to trigger an error and close the connection is when the wrong ack is received while there is still a frame waiting for its ack. In sync mode, this should never happen. This patch may be backported in all versions supporting the SPOE. (cherry picked from commit c7ba91039a7b0703971efd791ca2ca609afedb96) Signed-off-by: Christopher Faulet (cherry picked from commit d9eb3c3de3211478b512ee7f8e548bb78211adf5) Signed-off-by: Christopher Faulet (cherry picked from commit 3217a352a6d99b3b23b2f552aa7505a64389ac1e) Signed-off-by: Christopher Faulet --- diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 3b3bc16..0109a32 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -1042,8 +1042,17 @@ spoe_handle_agentack_frame(struct appctx *appctx, struct spoe_context **ctx, (unsigned int)stream_id, (unsigned int)frame_id); SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_FRAMEID_NOTFOUND; - if (appctx->st0 == SPOE_APPCTX_ST_WAITING_SYNC_ACK) - return -1; + if (appctx->st0 == SPOE_APPCTX_ST_WAITING_SYNC_ACK) { + /* Report an error if we are waiting the ack for another frame, + * but not if there is no longer frame waiting for a ack + * (timeout) + */ + if (!LIST_ISEMPTY(&SPOE_APPCTX(appctx)->waiting_queue) || + SPOE_APPCTX(appctx)->frag_ctx.ctx) + return -1; + appctx->st0 = SPOE_APPCTX_ST_PROCESSING; + SPOE_APPCTX(appctx)->cur_fpa = 0; + } return 0; found: