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 <cfaulet@haproxy.com>
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index 8e35018..58a7e79 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -1009,8 +1009,17 @@
 		    (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: