]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int: Remove SI_FL_KILL_CON to rely on conn-stream endpoint only
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Mar 2022 12:42:50 +0000 (14:42 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Apr 2022 13:10:14 +0000 (15:10 +0200)
Instead of setting a stream-interface flag to then set the corresponding
conn-stream endpoint flag, we now only rely the conn-stream endoint. Thus
SI_FL_KILL_CON is replaced by CS_EP_KILL_CONN.

In addition si_must_kill_conn() is replaced by cs_must_kill_conn().

dev/flags/flags.c
include/haproxy/cs_utils.h
include/haproxy/stream_interface-t.h
include/haproxy/stream_interface.h
src/http_act.c
src/stream_interface.c
src/tcp_rules.c

index ba4018d4807aab80e12f797dc77efd267564212e..5473903ceb5c2a917aa2f96cde5f42aac41e1863 100644 (file)
@@ -263,7 +263,6 @@ void show_si_flags(unsigned int f)
                return;
        }
 
-       SHOW_FLAG(f, SI_FL_KILL_CONN);
        SHOW_FLAG(f, SI_FL_WAIT_DATA);
        SHOW_FLAG(f, SI_FL_ISBACK);
        SHOW_FLAG(f, SI_FL_DONT_WAKE);
index 2346a8577b7cec32533418d4cb50682a74b86302..d44ea0c84543ea55bfdaf4eb6131b059b5022aa9 100644 (file)
@@ -187,4 +187,11 @@ static inline int cs_get_dst(struct conn_stream *cs)
        return 1;
 }
 
+
+/* Marks on the conn-stream that next shutw must kill the whole connection */
+static inline void cs_must_kill_conn(struct conn_stream *cs)
+{
+       cs->endp->flags |= CS_EP_KILL_CONN;
+}
+
 #endif /* _HAPROXY_CS_UTILS_H */
index 5fe805ed1046280e31a467f1a8127f56be339ed5..7766f4cb54e2bdb273849771658632aeb3242b32 100644 (file)
@@ -84,7 +84,6 @@ enum {
 enum {
        SI_FL_NONE       = 0x00000000,  /* nothing */
        /* unused: 0x00000001, 0x00000002 */
-       SI_FL_KILL_CONN  = 0x00000004,  /* next shutw must kill the whole conn, not just the stream */
        SI_FL_WAIT_DATA  = 0x00000008,  /* stream-int waits for more outgoing data to send */
        SI_FL_ISBACK     = 0x00000010,  /* 0 for front-side SI, 1 for back-side */
        SI_FL_DONT_WAKE  = 0x00000020,  /* resync in progress, don't wake up */
index 4424a7e7a623249c7ffafe5241356b690e4ec3a4..18892b271c8815db9be4ad98cdbffe81ca7006ad 100644 (file)
@@ -327,12 +327,6 @@ static inline void si_shutw(struct stream_interface *si)
        si->ops->shutw(si);
 }
 
-/* Marks on the stream-interface that next shutw must kill the whole connection */
-static inline void si_must_kill_conn(struct stream_interface *si)
-{
-       si->flags |= SI_FL_KILL_CONN;
-}
-
 /* This is to be used after making some room available in a channel. It will
  * return without doing anything if the stream interface's RX path is blocked.
  * It will automatically mark the stream interface as busy processing the end
index 8c53beecfdaa5bc2abd7ca3517a0e40b99a04c69..74a894ff7fae2d724de6e2d42553296d08058b70 100644 (file)
@@ -23,6 +23,8 @@
 #include <haproxy/capture-t.h>
 #include <haproxy/cfgparse.h>
 #include <haproxy/chunk.h>
+#include <haproxy/conn_stream.h>
+#include <haproxy/cs_utils.h>
 #include <haproxy/global.h>
 #include <haproxy/http.h>
 #include <haproxy/http_ana.h>
@@ -718,7 +720,7 @@ static enum act_parse_ret parse_http_set_status(const char **args, int *orig_arg
 static enum act_return http_action_reject(struct act_rule *rule, struct proxy *px,
                                           struct session *sess, struct stream *s, int flags)
 {
-       si_must_kill_conn(chn_prod(&s->req)->si);
+       cs_must_kill_conn(chn_prod(&s->req));
        channel_abort(&s->req);
        channel_abort(&s->res);
        s->req.analysers &= AN_REQ_FLT_END;
index f9c68390a9c9b03f1d7a6bdef1600e6a351ec034..dcbe1a1720f8386d689310d480f7050942612614 100644 (file)
@@ -1038,9 +1038,6 @@ static void stream_int_shutr_conn(struct stream_interface *si)
        if (!si_state_in(si->state, SI_SB_CON|SI_SB_RDY|SI_SB_EST))
                return;
 
-       if (si->flags & SI_FL_KILL_CONN)
-               cs->endp->flags |= CS_EP_KILL_CONN;
-
        if (si_oc(si)->flags & CF_SHUTW) {
                cs_close(cs);
                si->state = SI_ST_DIS;
@@ -1089,8 +1086,6 @@ static void stream_int_shutw_conn(struct stream_interface *si)
                 * However, if SI_FL_NOLINGER is explicitly set, we know there is
                 * no risk so we close both sides immediately.
                 */
-               if (si->flags & SI_FL_KILL_CONN)
-                       cs->endp->flags |= CS_EP_KILL_CONN;
 
                if (cs->endp->flags & CS_EP_ERROR) {
                        /* quick close, the socket is already shut anyway */
@@ -1121,8 +1116,6 @@ static void stream_int_shutw_conn(struct stream_interface *si)
                /* we may have to close a pending connection, and mark the
                 * response buffer as shutr
                 */
-               if (si->flags & SI_FL_KILL_CONN)
-                       cs->endp->flags |= CS_EP_KILL_CONN;
                cs_close(cs);
                /* fall through */
        case SI_ST_CER:
index 37d5bed3c1a5b299c698ce3606fcf360b4f94623..6c45f483e03da90addb6016326af6c42b8d11bfc 100644 (file)
@@ -17,6 +17,8 @@
 #include <haproxy/cfgparse.h>
 #include <haproxy/channel.h>
 #include <haproxy/connection.h>
+#include <haproxy/conn_stream.h>
+#include <haproxy/cs_utils.h>
 #include <haproxy/global.h>
 #include <haproxy/list.h>
 #include <haproxy/log.h>
@@ -253,7 +255,7 @@ resume_execution:
                _HA_ATOMIC_INC(&sess->listener->counters->failed_req);
 
  reject:
-       si_must_kill_conn(chn_prod(req)->si);
+       cs_must_kill_conn(chn_prod(req));
        channel_abort(req);
        channel_abort(&s->res);
 
@@ -391,7 +393,7 @@ resume_execution:
                        }
                        else if (rule->action == ACT_TCP_CLOSE) {
                                chn_prod(rep)->si->flags |= SI_FL_NOLINGER | SI_FL_NOHALF;
-                               si_must_kill_conn(chn_prod(rep)->si);
+                               cs_must_kill_conn(chn_prod(rep));
                                si_shutr(chn_prod(rep)->si);
                                si_shutw(chn_prod(rep)->si);
                                s->last_rule_file = rule->conf.file;
@@ -450,7 +452,7 @@ resume_execution:
                _HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp);
 
  reject:
-       si_must_kill_conn(chn_prod(rep)->si);
+       cs_must_kill_conn(chn_prod(rep));
        channel_abort(rep);
        channel_abort(&s->req);