diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 371037129..a1147665a 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -434,6 +434,7 @@ static void spoe_release_appctx(struct appctx *appctx) /* Shutdown the server connection, if needed */ if (appctx->st0 != SPOE_APPCTX_ST_END) { appctx->st0 = SPOE_APPCTX_ST_END; + applet_set_error(appctx); if (spoe_appctx->status_code == SPOP_ERR_NONE) spoe_appctx->status_code = SPOP_ERR_IO; } @@ -504,14 +505,15 @@ static void spoe_handle_appctx(struct appctx *appctx) goto out; } - if (!SPOE_APPCTX(appctx)->spoe_ctx) - appctx->st0 = SPOE_APPCTX_ST_EXIT; - switchstate: switch (appctx->st0) { /* case SPOE_APPCTX_ST_PROCESSING: */ case SPOE_APPCTX_ST_WAITING_ACK: - if (!spoe_handle_receiving_frame_appctx(appctx)) + if (!SPOE_APPCTX(appctx)->spoe_ctx) { + appctx->st0 = SPOE_APPCTX_ST_END; + applet_set_error(appctx); + } + else if (!spoe_handle_receiving_frame_appctx(appctx)) break; goto switchstate; @@ -1184,6 +1186,10 @@ static void spoe_destroy_context(struct filter *filter) if (!ctx) return; + if (ctx->state != SPOE_CTX_ST_NONE || ctx->state == SPOE_CTX_ST_READY) { + ctx->status_code = SPOE_CTX_ERR_INTERRUPT; + _HA_ATOMIC_INC(&conf->agent->counters.nb_errors); + } spoe_stop_processing(conf->agent, ctx); pool_free(pool_head_spoe_ctx, ctx); filter->ctx = NULL;