CLEANUP: stream/cli: remove the unneeded STATE_FIN state from "show sess"
This state is only an alias for "thr >= global.nbthread" which is the
sole condition that indicates the end and reaches it. Let's just drop
this state. There's only the STATE_LIST that's left.
diff --git a/src/stream.c b/src/stream.c
index f8f9eef..5a36a03 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -3156,7 +3156,6 @@
int pos; /* last position of the current session's buffer */
enum {
STATE_LIST = 0,
- STATE_FIN,
} state; /* dump state */
};
@@ -3545,6 +3544,11 @@
thread_isolate();
+ if (ctx->thr >= global.nbthread) {
+ /* already terminated */
+ goto done;
+ }
+
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
/* If we're forced to shut down, we might have to remove our
* reference to the last stream being dumped.
@@ -3559,7 +3563,7 @@
chunk_reset(&trash);
switch (ctx->state) {
- case STATE_LIST:
+ default:
/* first, let's detach the back-ref from a possible previous stream */
if (!LIST_ISEMPTY(&ctx->bref.users)) {
LIST_DELETE(&ctx->bref.users);
@@ -3744,11 +3748,6 @@
ctx->uid = 0;
goto done;
}
- /* fall through */
-
- default:
- ctx->state = STATE_FIN;
- goto done;
}
done:
thread_release();
@@ -3763,7 +3762,7 @@
{
struct show_sess_ctx *ctx = appctx->svcctx;
- if (ctx->state == STATE_LIST && ctx->thr < global.nbthread) {
+ if (ctx->thr < global.nbthread) {
/* a dump was aborted, either in error or timeout. We need to
* safely detach from the target stream's list. It's mandatory
* to lock because a stream on the target thread could be moving