]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stconn: Rename SC_FL_SHUTR_NOW in SC_FL_ABRT_WANTED
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 13 Apr 2023 13:39:30 +0000 (15:39 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 14 Apr 2023 12:06:01 +0000 (14:06 +0200)
It is the first step to transform shutdown for reads for the upper layer
into aborts. This patch is quite simple, it is just a flag renaming.

include/haproxy/channel.h
include/haproxy/stconn-t.h
src/cli.c
src/http_ana.c
src/stream.c

index 44728bbf6b3a48cb7017628a4aa01901d21cd2fd..4b93016594adb882524f9e8364c7f499c7ded0ef 100644 (file)
@@ -551,7 +551,7 @@ static inline void channel_htx_erase(struct channel *chn, struct htx *htx)
 /* marks the channel as "shutdown" ASAP for reads */
 static inline void channel_shutr_now(struct channel *chn)
 {
-       chn_prod(chn)->flags |= SC_FL_SHUTR_NOW;
+       chn_prod(chn)->flags |= SC_FL_ABRT_WANTED;
 }
 
 /* marks the channel as "shutdown" ASAP for writes */
@@ -563,7 +563,7 @@ static inline void channel_shutw_now(struct channel *chn)
 /* marks the channel as "shutdown" ASAP in both directions */
 static inline void channel_abort(struct channel *chn)
 {
-       chn_prod(chn)->flags |= SC_FL_SHUTR_NOW;
+       chn_prod(chn)->flags |= SC_FL_ABRT_WANTED;
        chn_cons(chn)->flags |= SC_FL_SHUTW_NOW;
        chn->flags |= CF_AUTO_CLOSE;
        chn->flags &= ~CF_AUTO_CONNECT;
index 63b882a6c26c2eca5123885c487d428550e3472c..cfc2eeb989e837fb98f393841eec2b660dcc4736 100644 (file)
@@ -158,7 +158,7 @@ enum sc_flags {
        SC_FL_SND_NEVERWAIT = 0x00001000,  /* Never wait for sending (permanent) */
        SC_FL_SND_EXP_MORE  = 0x00001000,  /* More data expected to be sent very soon. cleared when all data were sent */
 
-       SC_FL_SHUTR_NOW     = 0x00002000,  /* SC is shut down for reads */
+       SC_FL_ABRT_WANTED   = 0x00002000,  /* An abort was requested and must be performed ASAP */
        SC_FL_SHUTW_NOW     = 0x00004000,  /* SC must shut down for reads ASAP */
        SC_FL_SHUTR         = 0x00008000,  /* SC is shut down for writes */
        SC_FL_SHUTW         = 0x00010000,  /* SC must shut down for writes ASAP */
@@ -178,7 +178,7 @@ static forceinline char *sc_show_flags(char *buf, size_t len, const char *delim,
        _(SC_FL_DONT_WAKE, _(SC_FL_INDEP_STR, _(SC_FL_WONT_READ,
        _(SC_FL_NEED_BUFF, _(SC_FL_NEED_ROOM,
         _(SC_FL_RCV_ONCE, _(SC_FL_SND_ASAP, _(SC_FL_SND_NEVERWAIT, _(SC_FL_SND_EXP_MORE,
-       _(SC_FL_SHUTR_NOW, _(SC_FL_SHUTW_NOW, _(SC_FL_SHUTR, _(SC_FL_SHUTW)))))))))))))))));
+       _(SC_FL_ABRT_WANTED, _(SC_FL_SHUTW_NOW, _(SC_FL_SHUTR, _(SC_FL_SHUTW)))))))))))))))));
        /* epilogue */
        _(~0U);
        return buf;
index 820a45adcf8ad88891b1cc0c93fcf7b6923838d2..0de62035128ff281baf9ef951df4b4fb0d9ddba5 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2855,7 +2855,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                s->store_count = 0;
                s->uniq_id = global.req_count++;
 
-               s->scf->flags &= ~(SC_FL_SHUTR|SC_FL_SHUTR_NOW);
+               s->scf->flags &= ~(SC_FL_SHUTR|SC_FL_ABRT_WANTED);
                s->scf->flags &= ~SC_FL_SND_NEVERWAIT;
                s->scf->flags |= SC_FL_RCV_ONCE; /* one read is usually enough */
 
index 39da847c6d1b1f3f5db8c1b849300620cae23653..3ae76ed0dc6f1b17ffe126448ff1bc1037c8937f 100644 (file)
@@ -1132,7 +1132,7 @@ static __inline int do_l7_retry(struct stream *s, struct stconn *sc)
        res = &s->res;
 
        /* Remove any write error from the request, and read error from the response */
-       s->scf->flags &= ~(SC_FL_SHUTR|SC_FL_SHUTR_NOW);
+       s->scf->flags &= ~(SC_FL_SHUTR|SC_FL_ABRT_WANTED);
        req->flags &= ~CF_WRITE_TIMEOUT;
        res->flags &= ~(CF_READ_TIMEOUT | CF_READ_EVENT);
        res->analysers &= AN_RES_FLT_END;
index e45b321b5cf53502adb8f279d22077723d1ae4d5..cef544f12b3373d43e33c317b32ddbdb303f1276 100644 (file)
@@ -1954,7 +1954,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
  resync_request:
        /* Analyse request */
        if (((req->flags & ~rqf_last) & CF_MASK_ANALYSER) ||
-           ((scf->flags ^ scf_flags) & (SC_FL_SHUTR|SC_FL_SHUTR_NOW)) ||
+           ((scf->flags ^ scf_flags) & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) ||
            ((scb->flags ^ scb_flags) & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)) ||
            (req->analysers && (chn_cons(req)->flags & SC_FL_SHUTW)) ||
            scf->state != rq_prod_last ||
@@ -2042,7 +2042,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
                rq_cons_last = scb->state;
                req->flags &= ~CF_WAKE_ONCE;
                rqf_last = req->flags;
-               scf_flags = (scf_flags & ~(SC_FL_SHUTR|SC_FL_SHUTR_NOW)) | (scf->flags & (SC_FL_SHUTR|SC_FL_SHUTR_NOW));
+               scf_flags = (scf_flags & ~(SC_FL_SHUTR|SC_FL_ABRT_WANTED)) | (scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED));
                scb_flags = (scb_flags & ~(SC_FL_SHUTW|SC_FL_SHUTW_NOW)) | (scb->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW));
 
                if (((scf->flags ^ scf_flags_ana) & SC_FL_SHUTR) || ((scb->flags ^ scb_flags_ana) & SC_FL_SHUTW))
@@ -2059,7 +2059,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
        /* Analyse response */
 
        if (((res->flags & ~rpf_last) & CF_MASK_ANALYSER) ||
-           ((scb->flags ^ scb_flags) & (SC_FL_SHUTR|SC_FL_SHUTR_NOW)) ||
+           ((scb->flags ^ scb_flags) & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) ||
            ((scf->flags ^ scf_flags) & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)) ||
            (res->analysers && (chn_cons(res)->flags & SC_FL_SHUTW)) ||
            scf->state != rp_cons_last ||
@@ -2115,7 +2115,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
                rp_prod_last = scb->state;
                res->flags &= ~CF_WAKE_ONCE;
                rpf_last = res->flags;
-               scb_flags = (scb_flags & ~(SC_FL_SHUTR|SC_FL_SHUTR_NOW)) | (scb->flags & (SC_FL_SHUTR|SC_FL_SHUTR_NOW));
+               scb_flags = (scb_flags & ~(SC_FL_SHUTR|SC_FL_ABRT_WANTED)) | (scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED));
                scf_flags = (scf_flags & ~(SC_FL_SHUTW|SC_FL_SHUTW_NOW)) | (scf->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW));
 
                if (((scb->flags ^ scb_flags_ana) & SC_FL_SHUTR) || ((scf->flags ^ scf_flags_ana) & SC_FL_SHUTW))
@@ -2228,11 +2228,11 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
 
        /* If no one is interested in analysing data, it's time to forward
         * everything. We configure the buffer to forward indefinitely.
-        * Note that we're checking SC_FL_SHUTR_NOW as an indication of a possible
+        * Note that we're checking SC_FL_ABRT_WANTED as an indication of a possible
         * recent call to channel_abort().
         */
        if (unlikely((!req->analysers || (req->analysers == AN_REQ_FLT_END && !(req->flags & CF_FLT_ANALYZE))) &&
-                    !(scf->flags & SC_FL_SHUTR_NOW) && !(scb->flags & SC_FL_SHUTW) &&
+                    !(scf->flags & SC_FL_ABRT_WANTED) && !(scb->flags & SC_FL_SHUTW) &&
                     (sc_state_in(scf->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO)) &&
                     (req->to_forward != CHN_INFINITE_FORWARD))) {
                /* This buffer is freewheeling, there's no analyser
@@ -2283,7 +2283,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
 
        /* reflect what the L7 analysers have seen last */
        rqf_last = req->flags;
-       scf_flags = (scf_flags & ~(SC_FL_SHUTR|SC_FL_SHUTR_NOW)) | (scf->flags & (SC_FL_SHUTR|SC_FL_SHUTR_NOW));
+       scf_flags = (scf_flags & ~(SC_FL_SHUTR|SC_FL_ABRT_WANTED)) | (scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED));
        scb_flags = (scb_flags & ~(SC_FL_SHUTW|SC_FL_SHUTW_NOW)) | (scb->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW));
 
        /* it's possible that an upper layer has requested a connection setup or abort.
@@ -2379,12 +2379,12 @@ 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_SHUTR_NOW))) &&
+       if (unlikely((scb->flags & SC_FL_SHUTW) && !(scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED))) &&
            !req->analysers)
                channel_shutr_now(req);
 
        /* shutdown(read) pending */
-       if (unlikely((scf->flags & (SC_FL_SHUTR|SC_FL_SHUTR_NOW)) == SC_FL_SHUTR_NOW)) {
+       if (unlikely((scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) == SC_FL_ABRT_WANTED)) {
                if (scf->flags & SC_FL_NOHALF)
                        scf->flags |= SC_FL_NOLINGER;
                sc_shutr(scf);
@@ -2405,11 +2405,11 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
 
        /* If no one is interested in analysing data, it's time to forward
         * everything. We configure the buffer to forward indefinitely.
-        * Note that we're checking SC_FL_SHUTR_NOW as an indication of a possible
+        * Note that we're checking SC_FL_ABRT_WANTED as an indication of a possible
         * recent call to channel_abort().
         */
        if (unlikely((!res->analysers || (res->analysers == AN_RES_FLT_END && !(res->flags & CF_FLT_ANALYZE))) &&
-                    !(scf->flags & SC_FL_SHUTR_NOW) && !(scb->flags & SC_FL_SHUTW_NOW) &&
+                    !(scf->flags & SC_FL_ABRT_WANTED) && !(scb->flags & SC_FL_SHUTW_NOW) &&
                     sc_state_in(scb->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO) &&
                     (res->to_forward != CHN_INFINITE_FORWARD))) {
                /* This buffer is freewheeling, there's no analyser
@@ -2472,7 +2472,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
 
        /* reflect what the L7 analysers have seen last */
        rpf_last = res->flags;
-       scb_flags = (scb_flags & ~(SC_FL_SHUTR|SC_FL_SHUTR_NOW)) | (scb->flags & (SC_FL_SHUTR|SC_FL_SHUTR_NOW));
+       scb_flags = (scb_flags & ~(SC_FL_SHUTR|SC_FL_ABRT_WANTED)) | (scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED));
        scf_flags = (scf_flags & ~(SC_FL_SHUTW|SC_FL_SHUTW_NOW)) | (scf->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW));
 
        /* Let's see if we can send the pending response now */
@@ -2499,12 +2499,12 @@ 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_SHUTR_NOW))) &&
+       if (unlikely((scf->flags & SC_FL_SHUTW) && !(scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED))) &&
            !res->analysers)
                channel_shutr_now(res);
 
        /* shutdown(read) pending */
-       if (unlikely((scb->flags & (SC_FL_SHUTR|SC_FL_SHUTR_NOW)) == SC_FL_SHUTR_NOW)) {
+       if (unlikely((scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) == SC_FL_ABRT_WANTED)) {
                if (scb->flags & SC_FL_NOHALF)
                        scb->flags |= SC_FL_NOLINGER;
                sc_shutr(scb);
@@ -2519,7 +2519,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
        if ((req->flags & ~rqf_last) & CF_MASK_ANALYSER)
                goto resync_request;
 
-       if (((scb->flags ^ scb_flags) & (SC_FL_SHUTR|SC_FL_SHUTR_NOW)) ||
+       if (((scb->flags ^ scb_flags) & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) ||
            ((scf->flags ^ scf_flags) & (SC_FL_SHUTW|SC_FL_SHUTW_NOW)))
                goto resync_response;