]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: channel: Rename CF_WRITE_NULL to CF_WRITE_EVENT
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 12 Dec 2022 07:11:36 +0000 (08:11 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 9 Jan 2023 17:41:08 +0000 (18:41 +0100)
As for CF_READ_NULL, it appears CF_WRITE_NULL and other write events on a
channel are mainly used to wake up the stream and may be replace by on write
event.

In this patch, we introduce CF_WRITE_EVENT flag as a replacement to
CF_WRITE_EVENT_NULL. There is no breaking change for now, it is just a
rename. Gradually, other write events will be merged with this one.

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

index ff764a7a6e3d65d88fc3a10ae932a19cba26a87c..4e7557cb7448f9b3948b27272b2f2dd175b3fb5e 100644 (file)
@@ -31,7 +31,7 @@
  *
  *   - pure status flags, reported by the data layer, which must be cleared
  *     before doing further I/O :
- *     CF_*_NULL, CF_*_PARTIAL
+ *     CF_*_EVENT, CF_*_PARTIAL
  *
  *   - pure status flags, reported by stream connector layer, which must also
  *     be cleared before doing further I/O :
 #define CF_SHUTR_NOW      0x00000040  /* the producer must shut down for reads ASAP */
 #define CF_READ_NOEXP     0x00000080  /* producer should not expire */
 
-#define CF_WRITE_NULL     0x00000100  /* write(0) or connect() succeeded on consumer side */
+#define CF_WRITE_EVENT    0x00000100  /* a write event detected on consumer side */
 #define CF_WRITE_PARTIAL  0x00000200  /* some data were written to the consumer */
 #define CF_WRITE_TIMEOUT  0x00000400  /* timeout while waiting for consumer */
 #define CF_WRITE_ERROR    0x00000800  /* unrecoverable error on consumer side */
-#define CF_WRITE_ACTIVITY (CF_WRITE_NULL|CF_WRITE_PARTIAL|CF_WRITE_ERROR)
+#define CF_WRITE_ACTIVITY (CF_WRITE_EVENT|CF_WRITE_PARTIAL|CF_WRITE_ERROR)
 
 #define CF_WAKE_WRITE     0x00001000  /* wake the task up when there's write activity */
 #define CF_SHUTW          0x00002000  /* consumer has already shut down */
@@ -139,7 +139,7 @@ static forceinline char *chn_show_flags(char *buf, size_t len, const char *delim
        _(0);
        /* flags */
        _(CF_READ_EVENT, _(CF_READ_PARTIAL, _(CF_READ_TIMEOUT, _(CF_READ_ERROR,
-       _(CF_SHUTR, _(CF_SHUTR_NOW, _(CF_READ_NOEXP, _(CF_WRITE_NULL,
+       _(CF_SHUTR, _(CF_SHUTR_NOW, _(CF_READ_NOEXP, _(CF_WRITE_EVENT,
        _(CF_WRITE_PARTIAL, _(CF_WRITE_TIMEOUT, _(CF_WRITE_ERROR,
        _(CF_WAKE_WRITE, _(CF_SHUTW, _(CF_SHUTW_NOW, _(CF_AUTO_CLOSE,
        _(CF_STREAMER, _(CF_STREAMER_FAST, _(CF_WROTE_DATA, _(CF_ANA_TIMEOUT,
index bac8a08a5536f26919fd2c70dfc79f34a92c2a53..6e7c989e1af5750f5470083888ddcc5a6ef08b41 100644 (file)
@@ -1836,7 +1836,7 @@ skip_reuse:
        if (!sc_state_in(s->scb->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO) &&
            (srv_conn->flags & CO_FL_WAIT_XPRT) == 0) {
                s->conn_exp = TICK_ETERNITY;
-               sc_oc(s->scb)->flags |= CF_WRITE_NULL;
+               sc_oc(s->scb)->flags |= CF_WRITE_EVENT;
                if (s->scb->state == SC_ST_CON)
                        s->scb->state = SC_ST_RDY;
        }
index 7bd87d57708836810300f778698932cc0ccd6b5c..b7588a5f738271675a56cac2c9dbb6fb1cd7709f 100644 (file)
@@ -850,7 +850,7 @@ static void sc_app_chk_snd_conn(struct stconn *sc)
        /* in case of special condition (error, shutdown, end of write...), we
         * have to notify the task.
         */
-       if (likely((oc->flags & (CF_WRITE_NULL|CF_WRITE_ERROR|CF_SHUTW)) ||
+       if (likely((oc->flags & (CF_WRITE_EVENT|CF_WRITE_ERROR|CF_SHUTW)) ||
                  ((oc->flags & CF_WAKE_WRITE) &&
                   ((channel_is_empty(oc) && !oc->to_forward) ||
                    !sc_state_in(sc->state, SC_SB_EST))))) {
@@ -1201,7 +1201,7 @@ static void sc_notify(struct stconn *sc)
             ((ic->flags & CF_EOI) || !ic->to_forward || sco->state != SC_ST_EST)) ||
 
            /* changes on the consumption side */
-           (oc->flags & (CF_WRITE_NULL|CF_WRITE_ERROR)) ||
+           (oc->flags & (CF_WRITE_EVENT|CF_WRITE_ERROR)) ||
            ((oc->flags & CF_WRITE_ACTIVITY) &&
             ((oc->flags & CF_SHUTW) ||
              (((oc->flags & CF_WAKE_WRITE) ||
@@ -1776,7 +1776,7 @@ static int sc_conn_send(struct stconn *sc)
        return did_send;
 }
 
-/* perform a synchronous send() for the stream connector. The CF_WRITE_NULL and
+/* perform a synchronous send() for the stream connector. The CF_WRITE_EVENT and
  * CF_WRITE_PARTIAL flags are cleared prior to the attempt, and will possibly
  * be updated in case of success.
  */
@@ -1784,7 +1784,7 @@ void sc_conn_sync_send(struct stconn *sc)
 {
        struct channel *oc = sc_oc(sc);
 
-       oc->flags &= ~(CF_WRITE_NULL|CF_WRITE_PARTIAL);
+       oc->flags &= ~(CF_WRITE_EVENT|CF_WRITE_PARTIAL);
 
        if (oc->flags & CF_SHUTW)
                return;
@@ -1852,7 +1852,7 @@ static int sc_conn_process(struct stconn *sc)
            (conn->flags & CO_FL_WAIT_XPRT) == 0) {
                if (sc->flags & SC_FL_ISBACK)
                        __sc_strm(sc)->conn_exp = TICK_ETERNITY;
-               oc->flags |= CF_WRITE_NULL;
+               oc->flags |= CF_WRITE_EVENT;
                if (sc->state == SC_ST_CON)
                        sc->state = SC_ST_RDY;
        }
index 7d69328a2725d2e2d604a1ab1ea372f14a3899da..438d3ce088ac1e2559405c313250da8b4aaba3b2 100644 (file)
@@ -1553,8 +1553,8 @@ static void stream_update_both_sc(struct stream *s)
        struct channel *req = &s->req;
        struct channel *res = &s->res;
 
-       req->flags &= ~(CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_NULL|CF_WRITE_PARTIAL);
-       res->flags &= ~(CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_NULL|CF_WRITE_PARTIAL);
+       req->flags &= ~(CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_EVENT|CF_WRITE_PARTIAL);
+       res->flags &= ~(CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_EVENT|CF_WRITE_PARTIAL);
 
        s->prev_conn_state = scb->state;