]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: channel/stconn: Replace channel_shutr_now() by sc_schedule_abort()
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 13 Apr 2023 13:40:10 +0000 (15:40 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Apr 2023 12:08:49 +0000 (14:08 +0200)
After the flag renaming, it is now the turn for the channel function to be
renamed and moved in the SC scope. channel_shutr_now() is replaced by
sc_schedule_abort(). The request channel is replaced by the front SC and the
response is replace by the back SC.

include/haproxy/channel.h
include/haproxy/sc_strm.h
src/cli.c
src/hlua.c
src/http_ana.c
src/stream.c

index 4b93016594adb882524f9e8364c7f499c7ded0ef..50f0b754b59e60c380f39898fefb058b72fe99b7 100644 (file)
@@ -548,12 +548,6 @@ static inline void channel_htx_erase(struct channel *chn, struct htx *htx)
        channel_erase(chn);
 }
 
-/* marks the channel as "shutdown" ASAP for reads */
-static inline void channel_shutr_now(struct channel *chn)
-{
-       chn_prod(chn)->flags |= SC_FL_ABRT_WANTED;
-}
-
 /* marks the channel as "shutdown" ASAP for writes */
 static inline void channel_shutw_now(struct channel *chn)
 {
index 1161f53981490313d1e1ed00909572a16d610d0a..ae5861dc19042fe5ea2bff64ea2f21251bf994b0 100644 (file)
@@ -414,4 +414,10 @@ static inline void sc_set_hcto(struct stconn *sc)
 
 }
 
+/* Schedule an abort for the SC */
+static inline void sc_schedule_abort(struct stconn *sc)
+{
+       sc->flags |= SC_FL_ABRT_WANTED;
+}
+
 #endif /* _HAPROXY_SC_STRM_H */
index 0de62035128ff281baf9ef951df4b4fb0d9ddba5..f3562ae317924905f9cf35bf3d3ce67fb336395b 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2360,7 +2360,7 @@ int pcli_find_and_exec_kw(struct stream *s, char **args, int argl, char **errmsg
                return argl; /* return the number of elements in the array */
 
        } else if (strcmp("quit", args[0]) == 0) {
-               channel_shutr_now(&s->req);
+               sc_schedule_abort(s->scf);
                channel_shutw_now(&s->res);
                return argl; /* return the number of elements in the array */
        } else if (strcmp(args[0], "operator") == 0) {
index 913b237c9077728d0e5b813e71ad8ae42c8a85cd..a00a114165093948bf1e7740f97694250b260023 100644 (file)
@@ -8162,7 +8162,7 @@ __LJMP static int hlua_txn_done(lua_State *L)
 
                channel_auto_read(res);
                channel_auto_close(res);
-               channel_shutr_now(res);
+               sc_schedule_abort(s->scb);
 
                finst = ((htxn->dir == SMP_OPT_DIR_REQ) ? SF_FINST_R : SF_FINST_D);
                goto done;
index 3ae76ed0dc6f1b17ffe126448ff1bc1037c8937f..1ad56e471da573168a8afbc0aac90c7209f3c2cc 100644 (file)
@@ -4273,7 +4273,7 @@ static void http_end_request(struct stream *s)
                                goto check_channel_flags;
 
                        if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW))) {
-                               channel_shutr_now(chn);
+                               sc_schedule_abort(s->scf);
                                channel_shutw_now(chn);
                        }
                }
@@ -4372,7 +4372,7 @@ static void http_end_response(struct stream *s)
                         * transaction, so we can close it.
                         */
                        if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW))) {
-                               channel_shutr_now(chn);
+                               sc_schedule_abort(s->scb);
                                channel_shutw_now(chn);
                        }
                }
@@ -4449,7 +4449,7 @@ int http_forward_proxy_resp(struct stream *s, int final)
 
                channel_auto_read(res);
                channel_auto_close(res);
-               channel_shutr_now(res);
+               sc_schedule_abort(s->scb);
                s->scb->flags |= SC_FL_EOI; /* The response is terminated, add EOI */
                htxbuf(&res->buf)->flags |= HTX_FL_EOM; /* no more data are expected */
        }
@@ -4512,7 +4512,7 @@ end:
        channel_htx_erase(&s->req, htxbuf(&s->req.buf));
        channel_auto_read(&s->res);
        channel_auto_close(&s->res);
-       channel_shutr_now(&s->res);
+       sc_schedule_abort(s->scb);
 }
 
 struct http_reply *http_error_message(struct stream *s)
index cef544f12b3373d43e33c317b32ddbdb303f1276..f1b4c5bf811bd65dc36d84bac06d2df395610ae2 100644 (file)
@@ -861,7 +861,7 @@ void stream_retnclose(struct stream *s, const struct buffer *msg)
 
        channel_auto_read(oc);
        channel_auto_close(oc);
-       channel_shutr_now(oc);
+       sc_schedule_abort(s->scb);
 }
 
 int stream_set_timeout(struct stream *s, enum act_timeout_name name, int timeout)
@@ -2309,7 +2309,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
                else {
                        s->scb->state = SC_ST_CLO; /* shutw+ini = abort */
                        channel_shutw_now(req);        /* fix buffer flags upon abort */
-                       channel_shutr_now(res);
+                       sc_schedule_abort(scb);
                }
        }
 
@@ -2381,7 +2381,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
        /* shutdown(write) done on server side, we must stop the client too */
        if (unlikely((scb->flags & SC_FL_SHUTW) && !(scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED))) &&
            !req->analysers)
-               channel_shutr_now(req);
+               sc_schedule_abort(scf);
 
        /* shutdown(read) pending */
        if (unlikely((scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) == SC_FL_ABRT_WANTED)) {
@@ -2501,7 +2501,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
        /* shutdown(write) done on the client side, we must stop the server too */
        if (unlikely((scf->flags & SC_FL_SHUTW) && !(scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED))) &&
            !res->analysers)
-               channel_shutr_now(res);
+               sc_schedule_abort(scb);
 
        /* shutdown(read) pending */
        if (unlikely((scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) == SC_FL_ABRT_WANTED)) {
@@ -2782,7 +2782,7 @@ void stream_shutdown(struct stream *stream, int why)
                return;
 
        channel_shutw_now(&stream->req);
-       channel_shutr_now(&stream->res);
+       sc_schedule_abort(stream->scb);
        stream->task->nice = 1024;
        if (!(stream->flags & SF_ERR_MASK))
                stream->flags |= why;