BUG/MINOR: spoe: Be sure to be able to quickly close IDLE applets on soft-stop
On soft-stop, we try, as far as possible, to process all pending messages
before closing SPOE applets. However, in sync mode, when an applets waiting
for a response receives the ACK frame, it is switched to IDLE state without
checking if it may be closed. In this case, we will wait the idle timeout
before closing de applet, delaying the soft-stop.
To reduce this delay, on soft-stop, IDLE applets are woken up. On the next
wakeup, the applet will try to process pending messages or will be
closed.
This patch should be backported to all stable versions.
(cherry picked from commit 6547b1429287db162c9e9ac8945d75fb631843ee)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit f09ac12fc48279c271654b19052787098b682d3b)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 5f367ed50a9bde59e6fd15d50b2392ac6329c0f7)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 22986514477d8cb75cdf119a1f6fe7fd88e7abb4)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 95acb8417cb88e4a32f13b6d02378fc64c0579b2)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index 2237e27..76cded1 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -1983,10 +1983,9 @@
return;
}
out:
- if (stopping)
- spoe_wakeup_appctx(appctx);
-
- if (SPOE_APPCTX(appctx)->task->expire != TICK_ETERNITY)
+ if (stopping && appctx->st0 == SPOE_APPCTX_ST_IDLE)
+ task_wakeup(SPOE_APPCTX(appctx)->task, TASK_WOKEN_MSG);
+ else if (SPOE_APPCTX(appctx)->task->expire != TICK_ETERNITY)
task_queue(SPOE_APPCTX(appctx)->task);
}