From 30995115715cf600df107d29c5661f62f7c5b1de Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 25 Mar 2022 15:32:38 +0100 Subject: [PATCH] MINOR: conn-stream: Add ISBACK conn-stream flag CS_FL_ISBACK is a new flag, set on backend conn-streams. We must just be careful to preserve this flag when the endpoint is detached from the conn-stream. --- dev/flags/flags.c | 1 + include/haproxy/conn_stream-t.h | 1 + src/conn_stream.c | 2 +- src/stream.c | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/flags/flags.c b/dev/flags/flags.c index ddfd87906..50f48b1fb 100644 --- a/dev/flags/flags.c +++ b/dev/flags/flags.c @@ -219,6 +219,7 @@ void show_cs_flags(unsigned int f) printf("0\n"); return; } + SHOW_FLAG(f, CS_FL_ISBACK); if (f) { printf("EXTRA(0x%08x)", f); diff --git a/include/haproxy/conn_stream-t.h b/include/haproxy/conn_stream-t.h index bde6600ca..226d451fe 100644 --- a/include/haproxy/conn_stream-t.h +++ b/include/haproxy/conn_stream-t.h @@ -78,6 +78,7 @@ struct stream_interface; /* conn_stream flags */ enum { CS_FL_NONE = 0x00000000, /* Just for initialization purposes */ + CS_FL_ISBACK = 0x00000001, /* Set for CS on back-side */ }; /* cs_shutr() modes */ diff --git a/src/conn_stream.c b/src/conn_stream.c index bb5178448..45c82efba 100644 --- a/src/conn_stream.c +++ b/src/conn_stream.c @@ -267,7 +267,7 @@ void cs_detach_endp(struct conn_stream *cs) /* FIXME: Rest CS for now but must be reviewed. CS flags are only * connection related for now but this will evolved */ - cs->flags = CS_FL_NONE; + cs->flags &= CS_FL_ISBACK; if (cs->si) cs->si->ops = &si_embedded_ops; cs->data_cb = NULL; diff --git a/src/stream.c b/src/stream.c index b07de9bc0..535e5fa7f 100644 --- a/src/stream.c +++ b/src/stream.c @@ -446,7 +446,7 @@ struct stream *stream_new(struct session *sess, struct conn_stream *cs, struct b if (cs_attach_strm(s->csf, s) < 0) goto out_fail_attach_csf; - s->csb = cs_new_from_strm(s, CS_FL_NONE); + s->csb = cs_new_from_strm(s, CS_FL_ISBACK); if (!s->csb) goto out_fail_alloc_csb;