diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c index f277c8801..8274de228 100644 --- a/addons/promex/service-prometheus.c +++ b/addons/promex/service-prometheus.c @@ -1564,7 +1564,7 @@ static void promex_appctx_handle_io(struct appctx *appctx) } res_htx->flags |= HTX_FL_EOM; res->flags |= CF_EOI; - se_fl_set(appctx->endp, CS_EP_EOI); + se_fl_set(appctx->endp, SE_FL_EOI); appctx->st0 = PROMEX_ST_END; /* fall through */ diff --git a/dev/flags/flags.c b/dev/flags/flags.c index 3bcbb7f28..a9f12af74 100644 --- a/dev/flags/flags.c +++ b/dev/flags/flags.c @@ -184,33 +184,33 @@ void show_endp_flags(unsigned int f) return; } - SHOW_FLAG(f, CS_EP_RXBLK_CHAN); - SHOW_FLAG(f, CS_EP_RXBLK_BUFF); - SHOW_FLAG(f, CS_EP_RXBLK_ROOM); - SHOW_FLAG(f, CS_EP_RXBLK_SHUT); - SHOW_FLAG(f, CS_EP_RXBLK_CONN); - SHOW_FLAG(f, CS_EP_RX_WAIT_EP); - SHOW_FLAG(f, CS_EP_WANT_GET); - SHOW_FLAG(f, CS_EP_WAIT_DATA); - SHOW_FLAG(f, CS_EP_KILL_CONN); - SHOW_FLAG(f, CS_EP_WAIT_FOR_HS); - SHOW_FLAG(f, CS_EP_WANT_ROOM); - SHOW_FLAG(f, CS_EP_ERROR); - SHOW_FLAG(f, CS_EP_ERR_PENDING); - SHOW_FLAG(f, CS_EP_EOS); - SHOW_FLAG(f, CS_EP_EOI); - SHOW_FLAG(f, CS_EP_RCV_MORE); - SHOW_FLAG(f, CS_EP_MAY_SPLICE); - SHOW_FLAG(f, CS_EP_WEBSOCKET); - SHOW_FLAG(f, CS_EP_NOT_FIRST); - SHOW_FLAG(f, CS_EP_SHWS); - SHOW_FLAG(f, CS_EP_SHWN); - SHOW_FLAG(f, CS_EP_SHRR); - SHOW_FLAG(f, CS_EP_SHRD); - SHOW_FLAG(f, CS_EP_ORPHAN); - SHOW_FLAG(f, CS_EP_DETACHED); - SHOW_FLAG(f, CS_EP_T_APPLET); - SHOW_FLAG(f, CS_EP_T_MUX); + SHOW_FLAG(f, SE_FL_RXBLK_CHAN); + SHOW_FLAG(f, SE_FL_RXBLK_BUFF); + SHOW_FLAG(f, SE_FL_RXBLK_ROOM); + SHOW_FLAG(f, SE_FL_RXBLK_SHUT); + SHOW_FLAG(f, SE_FL_RXBLK_CONN); + SHOW_FLAG(f, SE_FL_RX_WAIT_EP); + SHOW_FLAG(f, SE_FL_WANT_GET); + SHOW_FLAG(f, SE_FL_WAIT_DATA); + SHOW_FLAG(f, SE_FL_KILL_CONN); + SHOW_FLAG(f, SE_FL_WAIT_FOR_HS); + SHOW_FLAG(f, SE_FL_WANT_ROOM); + SHOW_FLAG(f, SE_FL_ERROR); + SHOW_FLAG(f, SE_FL_ERR_PENDING); + SHOW_FLAG(f, SE_FL_EOS); + SHOW_FLAG(f, SE_FL_EOI); + SHOW_FLAG(f, SE_FL_RCV_MORE); + SHOW_FLAG(f, SE_FL_MAY_SPLICE); + SHOW_FLAG(f, SE_FL_WEBSOCKET); + SHOW_FLAG(f, SE_FL_NOT_FIRST); + SHOW_FLAG(f, SE_FL_SHWS); + SHOW_FLAG(f, SE_FL_SHWN); + SHOW_FLAG(f, SE_FL_SHRR); + SHOW_FLAG(f, SE_FL_SHRD); + SHOW_FLAG(f, SE_FL_ORPHAN); + SHOW_FLAG(f, SE_FL_DETACHED); + SHOW_FLAG(f, SE_FL_T_APPLET); + SHOW_FLAG(f, SE_FL_T_MUX); if (f) { printf("EXTRA(0x%08x)", f); diff --git a/include/haproxy/applet.h b/include/haproxy/applet.h index ed9827059..0fb508ce2 100644 --- a/include/haproxy/applet.h +++ b/include/haproxy/applet.h @@ -84,7 +84,7 @@ static inline void __appctx_free(struct appctx *appctx) LIST_DEL_INIT(&appctx->buffer_wait.list); if (appctx->sess) session_free(appctx->sess); - BUG_ON(appctx->endp && !se_fl_test(appctx->endp, CS_EP_ORPHAN)); + BUG_ON(appctx->endp && !se_fl_test(appctx->endp, SE_FL_ORPHAN)); cs_endpoint_free(appctx->endp); pool_free(pool_head_appctx, appctx); _HA_ATOMIC_DEC(&nb_applets); diff --git a/include/haproxy/conn_stream-t.h b/include/haproxy/conn_stream-t.h index b56e1bd03..a6d52ff17 100644 --- a/include/haproxy/conn_stream-t.h +++ b/include/haproxy/conn_stream-t.h @@ -26,62 +26,63 @@ #include #include -/* CS endpoint flags */ - enum { - CS_EP_NONE = 0x00000000, /* For initialization purposes */ +/* Stream Endpoint Flags */ +enum se_flags { + SE_FL_NONE = 0x00000000, /* For initialization purposes */ /* Endpoint types */ - CS_EP_T_MUX = 0x00000001, /* The endpoint is a mux (the target may be NULL before the mux init) */ - CS_EP_T_APPLET = 0x00000002, /* The endpoint is an applet */ + SE_FL_T_MUX = 0x00000001, /* The endpoint is a mux (the target may be NULL before the mux init) */ + SE_FL_T_APPLET = 0x00000002, /* The endpoint is an applet */ /* unused: 0x00000004 .. 0x00000008 */ /* Endpoint states: none == attached to a mux with a conn-stream */ - CS_EP_DETACHED = 0x00000010, /* The endpoint is detached (no mux/no applet) */ - CS_EP_ORPHAN = 0x00000020, /* The endpoint is orphan (no conn-stream) */ + SE_FL_DETACHED = 0x00000010, /* The endpoint is detached (no mux/no applet) */ + SE_FL_ORPHAN = 0x00000020, /* The endpoint is orphan (no conn-stream) */ /* unused: 0x00000040 .. 0x00000080 */ - CS_EP_SHRD = 0x00000100, /* read shut, draining extra data */ - CS_EP_SHRR = 0x00000200, /* read shut, resetting extra data */ - CS_EP_SHR = CS_EP_SHRD | CS_EP_SHRR, /* read shut status */ + SE_FL_SHRD = 0x00000100, /* read shut, draining extra data */ + SE_FL_SHRR = 0x00000200, /* read shut, resetting extra data */ + SE_FL_SHR = SE_FL_SHRD | SE_FL_SHRR, /* read shut status */ - CS_EP_SHWN = 0x00000400, /* write shut, verbose mode */ - CS_EP_SHWS = 0x00000800, /* write shut, silent mode */ - CS_EP_SHW = CS_EP_SHWN | CS_EP_SHWS, /* write shut status */ + SE_FL_SHWN = 0x00000400, /* write shut, verbose mode */ + SE_FL_SHWS = 0x00000800, /* write shut, silent mode */ + SE_FL_SHW = SE_FL_SHWN | SE_FL_SHWS, /* write shut status */ /* following flags are supposed to be set by the endpoint and read by * the app layer : */ + /* Permanent flags */ - CS_EP_NOT_FIRST = 0x00001000, /* This conn-stream is not the first one for the endpoint */ - CS_EP_WEBSOCKET = 0x00002000, /* The endpoint uses the websocket proto */ - CS_EP_EOI = 0x00004000, /* end-of-input reached */ - CS_EP_EOS = 0x00008000, /* End of stream delivered to data layer */ - CS_EP_ERROR = 0x00010000, /* a fatal error was reported */ + SE_FL_NOT_FIRST = 0x00001000, /* This conn-stream is not the first one for the endpoint */ + SE_FL_WEBSOCKET = 0x00002000, /* The endpoint uses the websocket proto */ + SE_FL_EOI = 0x00004000, /* end-of-input reached */ + SE_FL_EOS = 0x00008000, /* End of stream delivered to data layer */ + SE_FL_ERROR = 0x00010000, /* a fatal error was reported */ /* Transient flags */ - CS_EP_ERR_PENDING= 0x00020000, /* An error is pending, but there's still data to be read */ - CS_EP_MAY_SPLICE = 0x00040000, /* The endpoint may use the kernel splicing to forward data to the other side (implies CS_EP_CAN_SPLICE) */ - CS_EP_RCV_MORE = 0x00080000, /* Endpoint may have more bytes to transfer */ - CS_EP_WANT_ROOM = 0x00100000, /* More bytes to transfer, but not enough room */ - CS_EP_ENDP_MASK = 0x001ff000, /* Mask for flags set by the endpoint */ + SE_FL_ERR_PENDING= 0x00020000, /* An error is pending, but there's still data to be read */ + SE_FL_MAY_SPLICE = 0x00040000, /* The endpoint may use the kernel splicing to forward data to the other side (implies SE_FL_CAN_SPLICE) */ + SE_FL_RCV_MORE = 0x00080000, /* Endpoint may have more bytes to transfer */ + SE_FL_WANT_ROOM = 0x00100000, /* More bytes to transfer, but not enough room */ + SE_FL_ENDP_MASK = 0x001ff000, /* Mask for flags set by the endpoint */ /* following flags are supposed to be set by the app layer and read by * the endpoint : */ - CS_EP_WAIT_FOR_HS = 0x00200000, /* This stream is waiting for handhskae */ - CS_EP_KILL_CONN = 0x00400000, /* must kill the connection when the CS closes */ - CS_EP_WAIT_DATA = 0x00800000, /* CS waits for more outgoing data to send */ - CS_EP_WANT_GET = 0x01000000, /* CS would like to get some data from the buffer */ - CS_EP_RX_WAIT_EP = 0x02000000, /* CS waits for more data from the end point */ - CS_EP_RXBLK_CHAN = 0x04000000, /* the channel doesn't want the CS to introduce data */ - CS_EP_RXBLK_BUFF = 0x08000000, /* CS waits for a buffer allocation to complete */ - CS_EP_RXBLK_ROOM = 0x10000000, /* CS waits for more buffer room to store incoming data */ - CS_EP_RXBLK_SHUT = 0x20000000, /* input is now closed, nothing new will ever come */ - CS_EP_RXBLK_CONN = 0x40000000, /* other side is not connected */ - CS_EP_RXBLK_ANY = 0x7C000000, /* any of the RXBLK flags above */ - CS_EP_APP_MASK = 0x7fe00000, /* Mask for flags set by the app layer */ - }; + SE_FL_WAIT_FOR_HS = 0x00200000, /* This stream is waiting for handhskae */ + SE_FL_KILL_CONN = 0x00400000, /* must kill the connection when the CS closes */ + SE_FL_WAIT_DATA = 0x00800000, /* CS waits for more outgoing data to send */ + SE_FL_WANT_GET = 0x01000000, /* CS would like to get some data from the buffer */ + SE_FL_RX_WAIT_EP = 0x02000000, /* CS waits for more data from the end point */ + SE_FL_RXBLK_CHAN = 0x04000000, /* the channel doesn't want the CS to introduce data */ + SE_FL_RXBLK_BUFF = 0x08000000, /* CS waits for a buffer allocation to complete */ + SE_FL_RXBLK_ROOM = 0x10000000, /* CS waits for more buffer room to store incoming data */ + SE_FL_RXBLK_SHUT = 0x20000000, /* input is now closed, nothing new will ever come */ + SE_FL_RXBLK_CONN = 0x40000000, /* other side is not connected */ + SE_FL_RXBLK_ANY = 0x7C000000, /* any of the RXBLK flags above */ + SE_FL_APP_MASK = 0x7fe00000, /* Mask for flags set by the app layer */ +}; /* conn_stream flags */ enum { @@ -159,7 +160,7 @@ struct data_cb { * is the mux or the appctx * is the connection for connection-based streams * is the conn_stream we're attached to, or NULL - * CS_EP_* + * SE_FL_* */ struct cs_endpoint { void *target; diff --git a/include/haproxy/conn_stream.h b/include/haproxy/conn_stream.h index 0d71b07c3..f79feea51 100644 --- a/include/haproxy/conn_stream.h +++ b/include/haproxy/conn_stream.h @@ -140,7 +140,7 @@ static inline struct connection *__cs_conn(const struct conn_stream *cs) } static inline struct connection *cs_conn(const struct conn_stream *cs) { - if (sc_ep_test(cs, CS_EP_T_MUX)) + if (sc_ep_test(cs, SE_FL_T_MUX)) return __cs_conn(cs); return NULL; } @@ -165,7 +165,7 @@ static inline void *__cs_mux(const struct conn_stream *cs) } static inline struct appctx *cs_mux(const struct conn_stream *cs) { - if (sc_ep_test(cs, CS_EP_T_MUX)) + if (sc_ep_test(cs, SE_FL_T_MUX)) return __cs_mux(cs); return NULL; } @@ -180,7 +180,7 @@ static inline struct appctx *__cs_appctx(const struct conn_stream *cs) } static inline struct appctx *cs_appctx(const struct conn_stream *cs) { - if (sc_ep_test(cs, CS_EP_T_APPLET)) + if (sc_ep_test(cs, SE_FL_T_APPLET)) return __cs_appctx(cs); return NULL; } @@ -229,14 +229,14 @@ static inline void cs_conn_shutr(struct conn_stream *cs, enum co_shr_mode mode) BUG_ON(!cs_conn(cs)); - if (sc_ep_test(cs, CS_EP_SHR)) + if (sc_ep_test(cs, SE_FL_SHR)) return; /* clean data-layer shutdown */ mux = cs_conn_mux(cs); if (mux && mux->shutr) mux->shutr(cs, mode); - sc_ep_set(cs, (mode == CO_SHR_DRAIN) ? CS_EP_SHRD : CS_EP_SHRR); + sc_ep_set(cs, (mode == CO_SHR_DRAIN) ? SE_FL_SHRD : SE_FL_SHRR); } /* shut write */ @@ -246,14 +246,14 @@ static inline void cs_conn_shutw(struct conn_stream *cs, enum co_shw_mode mode) BUG_ON(!cs_conn(cs)); - if (sc_ep_test(cs, CS_EP_SHW)) + if (sc_ep_test(cs, SE_FL_SHW)) return; /* clean data-layer shutdown */ mux = cs_conn_mux(cs); if (mux && mux->shutw) mux->shutw(cs, mode); - sc_ep_set(cs, (mode == CO_SHW_NORMAL) ? CS_EP_SHWN : CS_EP_SHWS); + sc_ep_set(cs, (mode == CO_SHW_NORMAL) ? SE_FL_SHWN : SE_FL_SHWS); } /* completely close a conn_stream (but do not detach it) */ @@ -270,13 +270,13 @@ static inline void cs_conn_drain_and_shut(struct conn_stream *cs) cs_conn_shutr(cs, CO_SHR_DRAIN); } -/* sets CS_EP_ERROR or CS_EP_ERR_PENDING on the endpoint */ +/* sets SE_FL_ERROR or SE_FL_ERR_PENDING on the endpoint */ static inline void cs_ep_set_error(struct cs_endpoint *endp) { - if (se_fl_test(endp, CS_EP_EOS)) - se_fl_set(endp, CS_EP_ERROR); + if (se_fl_test(endp, SE_FL_EOS)) + se_fl_set(endp, SE_FL_ERROR); else - se_fl_set(endp, CS_EP_ERR_PENDING); + se_fl_set(endp, SE_FL_ERR_PENDING); } /* Retrieves any valid conn_stream from this connection, preferably the first @@ -301,7 +301,7 @@ static inline struct conn_stream *cs_conn_get_first(const struct connection *con /* Returns non-zero if the conn-stream's Rx path is blocked */ static inline int cs_rx_blocked(const struct conn_stream *cs) { - return !!sc_ep_test(cs, CS_EP_RXBLK_ANY); + return !!sc_ep_test(cs, SE_FL_RXBLK_ANY); } @@ -310,55 +310,55 @@ static inline int cs_rx_blocked(const struct conn_stream *cs) */ static inline int cs_rx_blocked_room(const struct conn_stream *cs) { - return !!sc_ep_test(cs, CS_EP_RXBLK_ROOM); + return !!sc_ep_test(cs, SE_FL_RXBLK_ROOM); } /* Returns non-zero if the conn-stream's endpoint is ready to receive */ static inline int cs_rx_endp_ready(const struct conn_stream *cs) { - return !sc_ep_test(cs, CS_EP_RX_WAIT_EP); + return !sc_ep_test(cs, SE_FL_RX_WAIT_EP); } /* The conn-stream announces it is ready to try to deliver more data to the input buffer */ static inline void cs_rx_endp_more(struct conn_stream *cs) { - sc_ep_clr(cs, CS_EP_RX_WAIT_EP); + sc_ep_clr(cs, SE_FL_RX_WAIT_EP); } /* The conn-stream announces it doesn't have more data for the input buffer */ static inline void cs_rx_endp_done(struct conn_stream *cs) { - sc_ep_set(cs, CS_EP_RX_WAIT_EP); + sc_ep_set(cs, SE_FL_RX_WAIT_EP); } /* Tell a conn-stream the input channel is OK with it sending it some data */ static inline void cs_rx_chan_rdy(struct conn_stream *cs) { - sc_ep_clr(cs, CS_EP_RXBLK_CHAN); + sc_ep_clr(cs, SE_FL_RXBLK_CHAN); } /* Tell a conn-stream the input channel is not OK with it sending it some data */ static inline void cs_rx_chan_blk(struct conn_stream *cs) { - sc_ep_set(cs, CS_EP_RXBLK_CHAN); + sc_ep_set(cs, SE_FL_RXBLK_CHAN); } /* Tell a conn-stream the other side is connected */ static inline void cs_rx_conn_rdy(struct conn_stream *cs) { - sc_ep_clr(cs, CS_EP_RXBLK_CONN); + sc_ep_clr(cs, SE_FL_RXBLK_CONN); } /* Tell a conn-stream it must wait for the other side to connect */ static inline void cs_rx_conn_blk(struct conn_stream *cs) { - sc_ep_set(cs, CS_EP_RXBLK_CONN); + sc_ep_set(cs, SE_FL_RXBLK_CONN); } /* The conn-stream just got the input buffer it was waiting for */ static inline void cs_rx_buff_rdy(struct conn_stream *cs) { - sc_ep_clr(cs, CS_EP_RXBLK_BUFF); + sc_ep_clr(cs, SE_FL_RXBLK_BUFF); } /* The conn-stream failed to get an input buffer and is waiting for it. @@ -368,13 +368,13 @@ static inline void cs_rx_buff_rdy(struct conn_stream *cs) */ static inline void cs_rx_buff_blk(struct conn_stream *cs) { - sc_ep_set(cs, CS_EP_RXBLK_BUFF); + sc_ep_set(cs, SE_FL_RXBLK_BUFF); } /* Tell a conn-stream some room was made in the input buffer */ static inline void cs_rx_room_rdy(struct conn_stream *cs) { - sc_ep_clr(cs, CS_EP_RXBLK_ROOM); + sc_ep_clr(cs, SE_FL_RXBLK_ROOM); } /* The conn-stream announces it failed to put data into the input buffer @@ -384,7 +384,7 @@ static inline void cs_rx_room_rdy(struct conn_stream *cs) */ static inline void cs_rx_room_blk(struct conn_stream *cs) { - sc_ep_set(cs, CS_EP_RXBLK_ROOM); + sc_ep_set(cs, SE_FL_RXBLK_ROOM); } /* The conn-stream announces it will never put new data into the input @@ -393,43 +393,43 @@ static inline void cs_rx_room_blk(struct conn_stream *cs) */ static inline void cs_rx_shut_blk(struct conn_stream *cs) { - sc_ep_set(cs, CS_EP_RXBLK_SHUT); + sc_ep_set(cs, SE_FL_RXBLK_SHUT); } /* Returns non-zero if the conn-stream's Tx path is blocked */ static inline int cs_tx_blocked(const struct conn_stream *cs) { - return !!sc_ep_test(cs, CS_EP_WAIT_DATA); + return !!sc_ep_test(cs, SE_FL_WAIT_DATA); } /* Returns non-zero if the conn-stream's endpoint is ready to transmit */ static inline int cs_tx_endp_ready(const struct conn_stream *cs) { - return sc_ep_test(cs, CS_EP_WANT_GET); + return sc_ep_test(cs, SE_FL_WANT_GET); } /* Report that a conn-stream wants to get some data from the output buffer */ static inline void cs_want_get(struct conn_stream *cs) { - sc_ep_set(cs, CS_EP_WANT_GET); + sc_ep_set(cs, SE_FL_WANT_GET); } /* Report that a conn-stream failed to get some data from the output buffer */ static inline void cs_cant_get(struct conn_stream *cs) { - sc_ep_set(cs, CS_EP_WANT_GET | CS_EP_WAIT_DATA); + sc_ep_set(cs, SE_FL_WANT_GET | SE_FL_WAIT_DATA); } /* Report that a conn-stream doesn't want to get data from the output buffer */ static inline void cs_stop_get(struct conn_stream *cs) { - sc_ep_clr(cs, CS_EP_WANT_GET); + sc_ep_clr(cs, SE_FL_WANT_GET); } /* Report that a conn-stream won't get any more data from the output buffer */ static inline void cs_done_get(struct conn_stream *cs) { - sc_ep_clr(cs, CS_EP_WANT_GET | CS_EP_WAIT_DATA); + sc_ep_clr(cs, SE_FL_WANT_GET | SE_FL_WAIT_DATA); } #endif /* _HAPROXY_CONN_STREAM_H */ diff --git a/include/haproxy/cs_utils.h b/include/haproxy/cs_utils.h index a5897bbf4..ecf7d8b54 100644 --- a/include/haproxy/cs_utils.h +++ b/include/haproxy/cs_utils.h @@ -150,8 +150,8 @@ static inline int cs_is_conn_error(const struct conn_stream *cs) * channel_alloc_buffer() for this so it abides by its rules. It returns 0 on * failure, non-zero otherwise. If no buffer is available, the requester, * represented by the pointer, will be added in the list of objects - * waiting for an available buffer, and CS_EP_RXBLK_BUFF will be set on the - * conn-stream and CS_EP_RX_WAIT_EP cleared. The requester will be responsible + * waiting for an available buffer, and SE_FL_RXBLK_BUFF will be set on the + * conn-stream and SE_FL_RX_WAIT_EP cleared. The requester will be responsible * for calling this function to try again once woken up. */ static inline int cs_alloc_ibuf(struct conn_stream *cs, struct buffer_wait *wait) @@ -268,7 +268,7 @@ static inline int cs_get_dst(struct conn_stream *cs) /* Marks on the conn-stream that next shutw must kill the whole connection */ static inline void cs_must_kill_conn(struct conn_stream *cs) { - sc_ep_set(cs, CS_EP_KILL_CONN); + sc_ep_set(cs, SE_FL_KILL_CONN); } @@ -292,7 +292,7 @@ static inline void cs_shutw(struct conn_stream *cs) */ static inline void cs_chk_rcv(struct conn_stream *cs) { - if (sc_ep_test(cs, CS_EP_RXBLK_CONN) && cs_state_in(cs_opposite(cs)->state, CS_SB_RDY|CS_SB_EST|CS_SB_DIS|CS_SB_CLO)) + if (sc_ep_test(cs, SE_FL_RXBLK_CONN) && cs_state_in(cs_opposite(cs)->state, CS_SB_RDY|CS_SB_EST|CS_SB_DIS|CS_SB_CLO)) cs_rx_conn_rdy(cs); if (cs_rx_blocked(cs) || !cs_rx_endp_ready(cs)) @@ -301,7 +301,7 @@ static inline void cs_chk_rcv(struct conn_stream *cs) if (!cs_state_in(cs->state, CS_SB_RDY|CS_SB_EST)) return; - sc_ep_set(cs, CS_EP_RX_WAIT_EP); + sc_ep_set(cs, SE_FL_RX_WAIT_EP); cs->ops->chk_rcv(cs); } diff --git a/include/haproxy/mux_quic.h b/include/haproxy/mux_quic.h index 4277a7d6f..fc7f98611 100644 --- a/include/haproxy/mux_quic.h +++ b/include/haproxy/mux_quic.h @@ -102,7 +102,7 @@ static inline struct conn_stream *qc_attach_cs(struct qcs *qcs, struct buffer *b qcs->endp->target = qcs; qcs->endp->conn = qcc->conn; - se_fl_set(qcs->endp, CS_EP_T_MUX | CS_EP_ORPHAN | CS_EP_NOT_FIRST); + se_fl_set(qcs->endp, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST); /* TODO duplicated from mux_h2 */ sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake; diff --git a/src/applet.c b/src/applet.c index aff991f74..c19749e0b 100644 --- a/src/applet.c +++ b/src/applet.c @@ -51,7 +51,7 @@ struct appctx *appctx_new(struct applet *applet, struct cs_endpoint *endp, unsig if (!endp) goto fail_endp; endp->target = appctx; - se_fl_set(endp, CS_EP_T_APPLET | CS_EP_ORPHAN); + se_fl_set(endp, SE_FL_T_APPLET | SE_FL_ORPHAN); } appctx->endp = endp; @@ -93,7 +93,7 @@ int appctx_finalize_startup(struct appctx *appctx, struct proxy *px, struct buff /* async startup is only possible for frontend appctx. Thus for orphan * appctx. Because no backend appctx can be orphan. */ - BUG_ON(!se_fl_test(appctx->endp, CS_EP_ORPHAN)); + BUG_ON(!se_fl_test(appctx->endp, SE_FL_ORPHAN)); sess = session_new(px, NULL, &appctx->obj_type); if (!sess) @@ -114,7 +114,7 @@ void appctx_free_on_early_error(struct appctx *appctx) /* If a frontend apctx is attached to a conn-stream, release the stream * instead of the appctx. */ - if (!se_fl_test(appctx->endp, CS_EP_ORPHAN) && !(appctx_cs(appctx)->flags & CS_FL_ISBACK)) { + if (!se_fl_test(appctx->endp, SE_FL_ORPHAN) && !(appctx_cs(appctx)->flags & CS_FL_ISBACK)) { stream_free(appctx_strm(appctx)); return; } @@ -145,13 +145,13 @@ void *applet_reserve_svcctx(struct appctx *appctx, size_t size) */ void appctx_shut(struct appctx *appctx) { - if (se_fl_test(appctx->endp, CS_EP_SHR | CS_EP_SHW)) + if (se_fl_test(appctx->endp, SE_FL_SHR | SE_FL_SHW)) return; if (appctx->applet->release) appctx->applet->release(appctx); - se_fl_set(appctx->endp, CS_EP_SHRR | CS_EP_SHWN); + se_fl_set(appctx->endp, SE_FL_SHRR | SE_FL_SHWN); } /* Callback used to wake up an applet when a buffer is available. The applet @@ -167,7 +167,7 @@ int appctx_buf_available(void *arg) struct conn_stream *cs = appctx_cs(appctx); /* allocation requested ? */ - if (!se_fl_test(appctx->endp, CS_EP_RXBLK_BUFF)) + if (!se_fl_test(appctx->endp, SE_FL_RXBLK_BUFF)) return 0; cs_rx_buff_rdy(cs); @@ -199,7 +199,7 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state) return NULL; } - if (se_fl_test(app->endp, CS_EP_ORPHAN)) { + if (se_fl_test(app->endp, SE_FL_ORPHAN)) { /* Finalize init of orphan appctx. .init callback function must * be defined and it must finalize appctx startup. */ @@ -244,8 +244,8 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state) /* measure the call rate and check for anomalies when too high */ rate = update_freq_ctr(&app->call_rate, 1); if (rate >= 100000 && app->call_rate.prev_ctr && // looped more than 100k times over last second - ((b_size(cs_ib(cs)) && se_fl_test(app->endp, CS_EP_RXBLK_BUFF)) || // asks for a buffer which is present - (b_size(cs_ib(cs)) && !b_data(cs_ib(cs)) && se_fl_test(app->endp, CS_EP_RXBLK_ROOM)) || // asks for room in an empty buffer + ((b_size(cs_ib(cs)) && se_fl_test(app->endp, SE_FL_RXBLK_BUFF)) || // asks for a buffer which is present + (b_size(cs_ib(cs)) && !b_data(cs_ib(cs)) && se_fl_test(app->endp, SE_FL_RXBLK_ROOM)) || // asks for room in an empty buffer (b_data(cs_ob(cs)) && cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)) || // asks for data already present (!b_data(cs_ib(cs)) && b_data(cs_ob(cs)) && // didn't return anything ... (cs_oc(cs)->flags & (CF_WRITE_PARTIAL|CF_SHUTW_NOW)) == CF_SHUTW_NOW))) { // ... and left data pending after a shut diff --git a/src/backend.c b/src/backend.c index 82be2e19a..eb4ad7d2c 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1578,7 +1578,7 @@ static int connect_server(struct stream *s) srv_conn = NULL; if (cs_reset_endp(s->csb) < 0) return SF_ERR_INTERNAL; - sc_ep_clr(s->csb, ~CS_EP_DETACHED); + sc_ep_clr(s->csb, ~SE_FL_DETACHED); } } else @@ -1826,7 +1826,7 @@ static int connect_server(struct stream *s) * loopback on a heavily loaded system. */ if (srv_conn->flags & CO_FL_ERROR) - sc_ep_set(s->csb, CS_EP_ERROR); + sc_ep_set(s->csb, SE_FL_ERROR); /* If we had early data, and the handshake ended, then * we can remove the flag, and attempt to wake the task up, @@ -1834,7 +1834,7 @@ static int connect_server(struct stream *s) * the handshake. */ if (!(srv_conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS))) - sc_ep_clr(s->csb, CS_EP_WAIT_FOR_HS); + sc_ep_clr(s->csb, SE_FL_WAIT_FOR_HS); if (!cs_state_in(s->csb->state, CS_SB_EST|CS_SB_DIS|CS_SB_CLO) && (srv_conn->flags & CO_FL_WAIT_XPRT) == 0) { @@ -1851,7 +1851,7 @@ static int connect_server(struct stream *s) * wake callback. Otherwise si_cs_recv()/si_cs_send() already take * care of it. */ - if (sc_ep_test(s->csb, CS_EP_EOI) && !(cs_ic(s->csb)->flags & CF_EOI)) + if (sc_ep_test(s->csb, SE_FL_EOI) && !(cs_ic(s->csb)->flags & CF_EOI)) cs_ic(s->csb)->flags |= (CF_EOI|CF_READ_PARTIAL); /* catch all sync connect while the mux is not already installed */ @@ -2045,7 +2045,7 @@ void back_try_conn_req(struct stream *s) * allocation problem, so we want to retry now. */ cs->state = CS_ST_CER; - sc_ep_clr(cs, CS_EP_ERROR); + sc_ep_clr(cs, SE_FL_ERROR); back_handle_st_cer(s); DBG_TRACE_STATE("connection error, retry", STRM_EV_STRM_PROC|STRM_EV_CS_ST|STRM_EV_STRM_ERR, s); @@ -2262,9 +2262,9 @@ void back_handle_st_con(struct stream *s) done: /* retryable error ? */ - if ((s->flags & SF_CONN_EXP) || sc_ep_test(cs, CS_EP_ERROR)) { + if ((s->flags & SF_CONN_EXP) || sc_ep_test(cs, SE_FL_ERROR)) { if (!s->conn_err_type) { - if (sc_ep_test(cs, CS_EP_ERROR)) + if (sc_ep_test(cs, SE_FL_ERROR)) s->conn_err_type = STRM_ET_CONN_ERR; else s->conn_err_type = STRM_ET_CONN_TO; @@ -2290,7 +2290,7 @@ void back_handle_st_con(struct stream *s) void back_handle_st_cer(struct stream *s) { struct conn_stream *cs = s->csb; - int must_tar = sc_ep_test(cs, CS_EP_ERROR); + int must_tar = sc_ep_test(cs, SE_FL_ERROR); DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s); @@ -2310,7 +2310,7 @@ void back_handle_st_cer(struct stream *s) _HA_ATOMIC_DEC(&__objt_server(s->target)->cur_sess); } - if (sc_ep_test(cs, CS_EP_ERROR) && + if (sc_ep_test(cs, SE_FL_ERROR) && conn && conn->err_code == CO_ER_SSL_MISMATCH_SNI) { /* We tried to connect to a server which is configured * with "verify required" and which doesn't have the @@ -2367,7 +2367,7 @@ void back_handle_st_cer(struct stream *s) * layers in an unexpected state (i.e < ST_CONN). * * Note: the conn-stream will be switched to ST_REQ, ST_ASS or - * ST_TAR and CS_EP_ERROR and SF_CONN_EXP flags will be unset. + * ST_TAR and SE_FL_ERROR and SF_CONN_EXP flags will be unset. */ if (cs_reset_endp(cs) < 0) { if (!s->conn_err_type) @@ -2489,7 +2489,7 @@ void back_handle_st_rdy(struct stream *s) } /* retryable error ? */ - if (sc_ep_test(cs, CS_EP_ERROR)) { + if (sc_ep_test(cs, SE_FL_ERROR)) { if (!s->conn_err_type) s->conn_err_type = STRM_ET_CONN_ERR; cs->state = CS_ST_CER; diff --git a/src/cache.c b/src/cache.c index 7ec3bc578..4f52d7298 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1527,7 +1527,7 @@ static void http_cache_io_handler(struct appctx *appctx) /* no more data are expected. */ res_htx->flags |= HTX_FL_EOM; res->flags |= CF_EOI; - se_fl_set(appctx->endp, CS_EP_EOI); + se_fl_set(appctx->endp, SE_FL_EOI); appctx->st0 = HTX_CACHE_END; } diff --git a/src/check.c b/src/check.c index 7e3e43c2e..da07710a0 100644 --- a/src/check.c +++ b/src/check.c @@ -793,7 +793,7 @@ void chk_report_conn_err(struct check *check, int errno_bck, int expired) retrieve_errno_from_socket(conn); if (conn && !(conn->flags & CO_FL_ERROR) && - cs && !sc_ep_test(cs, CS_EP_ERROR) && !expired) + cs && !sc_ep_test(cs, SE_FL_ERROR) && !expired) return; TRACE_ENTER(CHK_EV_HCHK_END|CHK_EV_HCHK_ERR, check, 0, 0, (size_t[]){expired}); @@ -912,7 +912,7 @@ void chk_report_conn_err(struct check *check, int errno_bck, int expired) } else if (conn->flags & CO_FL_WAIT_L4_CONN) { /* L4 not established (yet) */ - if (conn->flags & CO_FL_ERROR || sc_ep_test(cs, CS_EP_ERROR)) + if (conn->flags & CO_FL_ERROR || sc_ep_test(cs, SE_FL_ERROR)) set_server_check_status(check, HCHK_STATUS_L4CON, err_msg); else if (expired) set_server_check_status(check, HCHK_STATUS_L4TOUT, err_msg); @@ -927,12 +927,12 @@ void chk_report_conn_err(struct check *check, int errno_bck, int expired) } else if (conn->flags & CO_FL_WAIT_L6_CONN) { /* L6 not established (yet) */ - if (conn->flags & CO_FL_ERROR || sc_ep_test(cs, CS_EP_ERROR)) + if (conn->flags & CO_FL_ERROR || sc_ep_test(cs, SE_FL_ERROR)) set_server_check_status(check, HCHK_STATUS_L6RSP, err_msg); else if (expired) set_server_check_status(check, HCHK_STATUS_L6TOUT, err_msg); } - else if (conn->flags & CO_FL_ERROR || sc_ep_test(cs, CS_EP_ERROR)) { + else if (conn->flags & CO_FL_ERROR || sc_ep_test(cs, SE_FL_ERROR)) { /* I/O error after connection was established and before we could diagnose */ set_server_check_status(check, HCHK_STATUS_SOCKERR, err_msg); } @@ -1038,7 +1038,7 @@ static int wake_srv_chk(struct conn_stream *cs) cs = check->cs; conn = cs_conn(cs); - if (unlikely(!conn || !cs || conn->flags & CO_FL_ERROR || sc_ep_test(cs, CS_EP_ERROR))) { + if (unlikely(!conn || !cs || conn->flags & CO_FL_ERROR || sc_ep_test(cs, SE_FL_ERROR))) { /* We may get error reports bypassing the I/O handlers, typically * the case when sending a pure TCP check which fails, then the I/O * handlers above are not called. This is completely handled by the @@ -1146,7 +1146,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state) /* Here the connection must be defined. Otherwise the * error would have already been detected */ - if ((conn && ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, CS_EP_ERROR))) || expired) { + if ((conn && ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR))) || expired) { TRACE_ERROR("report connection error", CHK_EV_TASK_WAKE|CHK_EV_HCHK_END|CHK_EV_HCHK_ERR, check); chk_report_conn_err(check, 0, expired); } @@ -1157,9 +1157,9 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state) conn = NULL; if (!cs_reset_endp(check->cs)) { /* error will be handled by tcpcheck_main(). - * On success, remove all flags except CS_EP_DETACHED + * On success, remove all flags except SE_FL_DETACHED */ - sc_ep_clr(check->cs, ~CS_EP_DETACHED); + sc_ep_clr(check->cs, ~SE_FL_DETACHED); } tcpcheck_main(check); } diff --git a/src/cli.c b/src/cli.c index a02039498..f9a0a4f2b 100644 --- a/src/cli.c +++ b/src/cli.c @@ -1108,7 +1108,7 @@ static void cli_io_handler(struct appctx *appctx) } break; default: /* abnormal state */ - se_fl_set(appctx->endp, CS_EP_ERROR); + se_fl_set(appctx->endp, SE_FL_ERROR); break; } @@ -2782,7 +2782,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit) s->srv_error(s, s->csb); return 1; } - se_fl_clr(s->csb->endp, ~CS_EP_DETACHED); + se_fl_clr(s->csb->endp, ~SE_FL_DETACHED); } sockaddr_free(&s->csb->dst); diff --git a/src/conn_stream.c b/src/conn_stream.c index bc8d3e2ae..5fe04c48f 100644 --- a/src/conn_stream.c +++ b/src/conn_stream.c @@ -87,7 +87,7 @@ void cs_endpoint_init(struct cs_endpoint *endp) endp->target = NULL; endp->conn = NULL; endp->cs = NULL; - se_fl_setall(endp, CS_EP_NONE); + se_fl_setall(endp, SE_FL_NONE); } /* Tries to alloc an endpoint and initialize it. Returns NULL on failure. */ @@ -113,7 +113,7 @@ void cs_endpoint_free(struct cs_endpoint *endp) /* Tries to allocate a new conn_stream and initialize its main fields. On * failure, nothing is allocated and NULL is returned. It is an internal - * function. The caller must, at least, set the CS_EP_ORPHAN or CS_EP_DETACHED + * function. The caller must, at least, set the SE_FL_ORPHAN or SE_FL_DETACHED * flag. */ static struct conn_stream *cs_new(struct cs_endpoint *endp) @@ -154,7 +154,7 @@ static struct conn_stream *cs_new(struct cs_endpoint *endp) /* Creates a new conn-stream and its associated stream from a mux. must be * defined. It returns NULL on error. On success, the new conn-stream is - * returned. In this case, CS_EP_ORPHAN flag is removed. + * returned. In this case, SE_FL_ORPHAN flag is removed. */ struct conn_stream *cs_new_from_endp(struct cs_endpoint *endp, struct session *sess, struct buffer *input) { @@ -167,12 +167,12 @@ struct conn_stream *cs_new_from_endp(struct cs_endpoint *endp, struct session *s pool_free(pool_head_connstream, cs); cs = NULL; } - se_fl_clr(endp, CS_EP_ORPHAN); + se_fl_clr(endp, SE_FL_ORPHAN); return cs; } /* Creates a new conn-stream from an stream. There is no endpoint here, thus it - * will be created by cs_new(). So the CS_EP_DETACHED flag is set. It returns + * will be created by cs_new(). So the SE_FL_DETACHED flag is set. It returns * NULL on error. On success, the new conn-stream is returned. */ struct conn_stream *cs_new_from_strm(struct stream *strm, unsigned int flags) @@ -183,7 +183,7 @@ struct conn_stream *cs_new_from_strm(struct stream *strm, unsigned int flags) if (unlikely(!cs)) return NULL; cs->flags |= flags; - sc_ep_set(cs, CS_EP_DETACHED); + sc_ep_set(cs, SE_FL_DETACHED); cs->app = &strm->obj_type; cs->ops = &cs_app_embedded_ops; cs->data_cb = NULL; @@ -191,7 +191,7 @@ struct conn_stream *cs_new_from_strm(struct stream *strm, unsigned int flags) } /* Creates a new conn-stream from an health-check. There is no endpoint here, - * thus it will be created by cs_new(). So the CS_EP_DETACHED flag is set. It + * thus it will be created by cs_new(). So the SE_FL_DETACHED flag is set. It * returns NULL on error. On success, the new conn-stream is returned. */ struct conn_stream *cs_new_from_check(struct check *check, unsigned int flags) @@ -202,7 +202,7 @@ struct conn_stream *cs_new_from_check(struct check *check, unsigned int flags) if (unlikely(!cs)) return NULL; cs->flags |= flags; - sc_ep_set(cs, CS_EP_DETACHED); + sc_ep_set(cs, SE_FL_DETACHED); cs->app = &check->obj_type; cs->data_cb = &check_conn_cb; return cs; @@ -216,7 +216,7 @@ void cs_free(struct conn_stream *cs) sockaddr_free(&cs->src); sockaddr_free(&cs->dst); if (cs->endp) { - BUG_ON(!sc_ep_test(cs, CS_EP_DETACHED)); + BUG_ON(!sc_ep_test(cs, SE_FL_DETACHED)); cs_endpoint_free(cs->endp); } if (cs->wait_event.tasklet) @@ -232,7 +232,7 @@ static void cs_free_cond(struct conn_stream **csp) { struct conn_stream *cs = *csp; - if (!cs->app && (!cs->endp || sc_ep_test(cs, CS_EP_DETACHED))) { + if (!cs->app && (!cs->endp || sc_ep_test(cs, SE_FL_DETACHED))) { cs_free(cs); *csp = NULL; } @@ -240,7 +240,7 @@ static void cs_free_cond(struct conn_stream **csp) /* Attaches a conn_stream to a mux endpoint and sets the endpoint ctx. Returns - * -1 on error and 0 on sucess. CS_EP_DETACHED flag is removed. This function is + * -1 on error and 0 on sucess. SE_FL_DETACHED flag is removed. This function is * called from a mux when it is attached to a stream or a health-check. */ int cs_attach_mux(struct conn_stream *cs, void *target, void *ctx) @@ -249,8 +249,8 @@ int cs_attach_mux(struct conn_stream *cs, void *target, void *ctx) cs->endp->target = target; cs->endp->conn = ctx; - sc_ep_set(cs, CS_EP_T_MUX); - sc_ep_clr(cs, CS_EP_DETACHED); + sc_ep_set(cs, SE_FL_T_MUX); + sc_ep_clr(cs, SE_FL_DETACHED); if (!conn->ctx) conn->ctx = cs; if (cs_strm(cs)) { @@ -282,15 +282,15 @@ int cs_attach_mux(struct conn_stream *cs, void *target, void *ctx) } /* Attaches a conn_stream to an applet endpoint and sets the endpoint - * ctx. Returns -1 on error and 0 on sucess. CS_EP_DETACHED flag is + * ctx. Returns -1 on error and 0 on sucess. SE_FL_DETACHED flag is * removed. This function is called by a stream when a backend applet is * registered. */ static void cs_attach_applet(struct conn_stream *cs, void *target) { cs->endp->target = target; - sc_ep_set(cs, CS_EP_T_APPLET); - sc_ep_clr(cs, CS_EP_DETACHED); + sc_ep_set(cs, SE_FL_T_APPLET); + sc_ep_clr(cs, SE_FL_DETACHED); if (cs_strm(cs)) { cs->ops = &cs_app_applet_ops; cs->data_cb = &cs_data_applet_cb; @@ -298,15 +298,15 @@ static void cs_attach_applet(struct conn_stream *cs, void *target) } /* Attaches a conn_stream to a app layer and sets the relevant - * callbacks. Returns -1 on error and 0 on success. CS_EP_ORPHAN flag is + * callbacks. Returns -1 on error and 0 on success. SE_FL_ORPHAN flag is * removed. This function is called by a stream when it is created to attach it * on the conn-stream on the client side. */ int cs_attach_strm(struct conn_stream *cs, struct stream *strm) { cs->app = &strm->obj_type; - sc_ep_clr(cs, CS_EP_ORPHAN); - if (sc_ep_test(cs, CS_EP_T_MUX)) { + sc_ep_clr(cs, SE_FL_ORPHAN); + if (sc_ep_test(cs, SE_FL_T_MUX)) { cs->wait_event.tasklet = tasklet_new(); if (!cs->wait_event.tasklet) return -1; @@ -317,7 +317,7 @@ int cs_attach_strm(struct conn_stream *cs, struct stream *strm) cs->ops = &cs_app_conn_ops; cs->data_cb = &cs_data_conn_cb; } - else if (sc_ep_test(cs, CS_EP_T_APPLET)) { + else if (sc_ep_test(cs, SE_FL_T_APPLET)) { cs->ops = &cs_app_applet_ops; cs->data_cb = &cs_data_applet_cb; } @@ -345,14 +345,14 @@ static void cs_detach_endp(struct conn_stream **csp) if (!cs->endp) goto reset_cs; - if (sc_ep_test(cs, CS_EP_T_MUX)) { + if (sc_ep_test(cs, SE_FL_T_MUX)) { struct connection *conn = __cs_conn(cs); struct cs_endpoint *endp = cs->endp; if (conn->mux) { if (cs->wait_event.events != 0) conn->mux->unsubscribe(cs, cs->wait_event.events, &cs->wait_event); - se_fl_set(endp, CS_EP_ORPHAN); + se_fl_set(endp, SE_FL_ORPHAN); endp->cs = NULL; cs->endp = NULL; conn->mux->detach(endp); @@ -368,10 +368,10 @@ static void cs_detach_endp(struct conn_stream **csp) conn_free(conn); } } - else if (sc_ep_test(cs, CS_EP_T_APPLET)) { + else if (sc_ep_test(cs, SE_FL_T_APPLET)) { struct appctx *appctx = __cs_appctx(cs); - sc_ep_set(cs, CS_EP_ORPHAN); + sc_ep_set(cs, SE_FL_ORPHAN); cs->endp->cs = NULL; cs->endp = NULL; appctx_shut(appctx); @@ -382,8 +382,8 @@ static void cs_detach_endp(struct conn_stream **csp) /* the cs is the only one one the endpoint */ cs->endp->target = NULL; cs->endp->conn = NULL; - sc_ep_clr(cs, ~CS_EP_APP_MASK); - sc_ep_set(cs, CS_EP_DETACHED); + sc_ep_clr(cs, ~SE_FL_APP_MASK); + sc_ep_set(cs, SE_FL_DETACHED); } reset_cs: @@ -433,7 +433,7 @@ void cs_destroy(struct conn_stream *cs) * its endpoint. For a connection retry for instance. If a mux or an applet is * attached, a new endpoint is created. Returns -1 on error and 0 on sucess. * - * Only CS_EP_ERROR flag is removed on the endpoint. Orther flags are preserved. + * Only SE_FL_ERROR flag is removed on the endpoint. Orther flags are preserved. * It is the caller responsibility to remove other flags if needed. */ int cs_reset_endp(struct conn_stream *cs) @@ -442,7 +442,7 @@ int cs_reset_endp(struct conn_stream *cs) BUG_ON(!cs->app); - sc_ep_clr(cs, CS_EP_ERROR); + sc_ep_clr(cs, SE_FL_ERROR); if (!__cs_endp_target(cs)) { /* endpoint not attached or attached to a mux with no * target. Thus the endpoint will not be release but just @@ -457,17 +457,17 @@ int cs_reset_endp(struct conn_stream *cs) * fails */ new_endp = cs_endpoint_new(); if (!unlikely(new_endp)) { - sc_ep_set(cs, CS_EP_ERROR); + sc_ep_set(cs, SE_FL_ERROR); return -1; } - se_fl_setall(new_endp, sc_ep_get(cs) & CS_EP_APP_MASK); + se_fl_setall(new_endp, sc_ep_get(cs) & SE_FL_APP_MASK); /* The app is still attached, the cs will not be released */ cs_detach_endp(&cs); BUG_ON(cs->endp); cs->endp = new_endp; cs->endp->cs = cs; - sc_ep_set(cs, CS_EP_DETACHED); + sc_ep_set(cs, SE_FL_DETACHED); return 0; } @@ -563,7 +563,7 @@ static void cs_app_shutw(struct conn_stream *cs) * However, if CS_FL_NOLINGER is explicitly set, we know there is * no risk so we close both sides immediately. */ - if (!sc_ep_test(cs, CS_EP_ERROR) && !(cs->flags & CS_FL_NOLINGER) && + if (!sc_ep_test(cs, SE_FL_ERROR) && !(cs->flags & CS_FL_NOLINGER) && !(ic->flags & (CF_SHUTR|CF_DONT_READ))) return; @@ -620,14 +620,14 @@ static void cs_app_chk_snd(struct conn_stream *cs) if (unlikely(cs->state != CS_ST_EST || (oc->flags & CF_SHUTW))) return; - if (!sc_ep_test(cs, CS_EP_WAIT_DATA) || /* not waiting for data */ + if (!sc_ep_test(cs, SE_FL_WAIT_DATA) || /* not waiting for data */ channel_is_empty(oc)) /* called with nothing to send ! */ return; /* Otherwise there are remaining data to be sent in the buffer, * so we tell the handler. */ - sc_ep_clr(cs, CS_EP_WAIT_DATA); + sc_ep_clr(cs, SE_FL_WAIT_DATA); if (!tick_isset(oc->wex)) oc->wex = tick_add_ifset(now_ms, oc->wto); @@ -708,7 +708,7 @@ static void cs_app_shutw_conn(struct conn_stream *cs) * no risk so we close both sides immediately. */ - if (sc_ep_test(cs, CS_EP_ERROR)) { + if (sc_ep_test(cs, SE_FL_ERROR)) { /* quick close, the socket is already shut anyway */ } else if (cs->flags & CS_FL_NOLINGER) { @@ -788,16 +788,16 @@ static void cs_app_chk_snd_conn(struct conn_stream *cs) return; if (!oc->pipe && /* spliced data wants to be forwarded ASAP */ - !sc_ep_test(cs, CS_EP_WAIT_DATA)) /* not waiting for data */ + !sc_ep_test(cs, SE_FL_WAIT_DATA)) /* not waiting for data */ return; if (!(cs->wait_event.events & SUB_RETRY_SEND) && !channel_is_empty(cs_oc(cs))) cs_conn_send(cs); - if (sc_ep_test(cs, CS_EP_ERROR | CS_EP_ERR_PENDING) || cs_is_conn_error(cs)) { + if (sc_ep_test(cs, SE_FL_ERROR | SE_FL_ERR_PENDING) || cs_is_conn_error(cs)) { /* Write error on the file descriptor */ if (cs->state >= CS_ST_CON) - sc_ep_set(cs, CS_EP_ERROR); + sc_ep_set(cs, SE_FL_ERROR); goto out_wakeup; } @@ -818,14 +818,14 @@ static void cs_app_chk_snd_conn(struct conn_stream *cs) } if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == 0) - sc_ep_set(cs, CS_EP_WAIT_DATA); + sc_ep_set(cs, SE_FL_WAIT_DATA); oc->wex = TICK_ETERNITY; } else { /* Otherwise there are remaining data to be sent in the buffer, * which means we have to poll before doing so. */ - sc_ep_clr(cs, CS_EP_WAIT_DATA); + sc_ep_clr(cs, SE_FL_WAIT_DATA); if (!tick_isset(oc->wex)) oc->wex = tick_add_ifset(now_ms, oc->wto); } @@ -938,7 +938,7 @@ static void cs_app_shutw_applet(struct conn_stream *cs) * However, if CS_FL_NOLINGER is explicitly set, we know there is * no risk so we close both sides immediately. */ - if (!sc_ep_test(cs, CS_EP_ERROR) && !(cs->flags & CS_FL_NOLINGER) && + if (!sc_ep_test(cs, SE_FL_ERROR) && !(cs->flags & CS_FL_NOLINGER) && !(ic->flags & (CF_SHUTR|CF_DONT_READ))) return; @@ -993,7 +993,7 @@ static void cs_app_chk_snd_applet(struct conn_stream *cs) /* we only wake the applet up if it was waiting for some data */ - if (!sc_ep_test(cs, CS_EP_WAIT_DATA)) + if (!sc_ep_test(cs, SE_FL_WAIT_DATA)) return; if (!tick_isset(oc->wex)) @@ -1042,7 +1042,7 @@ void cs_update_rx(struct conn_stream *cs) */ cs_rx_room_rdy(cs); } - if (sc_ep_test(cs, CS_EP_RXBLK_ANY)) + if (sc_ep_test(cs, SE_FL_RXBLK_ANY)) ic->rex = TICK_ETERNITY; else if (!(ic->flags & CF_READ_NOEXP) && !tick_isset(ic->rex)) ic->rex = tick_add_ifset(now_ms, ic->rto); @@ -1070,9 +1070,9 @@ void cs_update_tx(struct conn_stream *cs) /* Write not closed, update FD status and timeout for writes */ if (channel_is_empty(oc)) { /* stop writing */ - if (!sc_ep_test(cs, CS_EP_WAIT_DATA)) { + if (!sc_ep_test(cs, SE_FL_WAIT_DATA)) { if ((oc->flags & CF_SHUTW_NOW) == 0) - sc_ep_set(cs, CS_EP_WAIT_DATA); + sc_ep_set(cs, SE_FL_WAIT_DATA); oc->wex = TICK_ETERNITY; } return; @@ -1083,7 +1083,7 @@ void cs_update_tx(struct conn_stream *cs) * update it if is was not yet set. The stream socket handler will already * have updated it if there has been a completed I/O. */ - sc_ep_clr(cs, CS_EP_WAIT_DATA); + sc_ep_clr(cs, SE_FL_WAIT_DATA); if (!tick_isset(oc->wex)) { oc->wex = tick_add_ifset(now_ms, oc->wto); if (tick_isset(ic->rex) && !(cs->flags & CS_FL_INDEP_STR)) { @@ -1103,7 +1103,7 @@ void cs_update_tx(struct conn_stream *cs) * layers (applets, connections) after I/O completion. After updating the stream * interface and timeouts, it will try to forward what can be forwarded, then to * wake the associated task up if an important event requires special handling. - * It may update CS_EP_WAIT_DATA and/or CS_EP_RXBLK_ROOM, that the callers are + * It may update SE_FL_WAIT_DATA and/or SE_FL_RXBLK_ROOM, that the callers are * encouraged to watch to take appropriate action. * It should not be called from within the stream itself, cs_update() * is designed for this. @@ -1129,9 +1129,9 @@ static void cs_notify(struct conn_stream *cs) * we're about to close and can't expect more data if SHUTW_NOW is there. */ if (!(oc->flags & (CF_SHUTW|CF_SHUTW_NOW))) - sc_ep_set(cs, CS_EP_WAIT_DATA); + sc_ep_set(cs, SE_FL_WAIT_DATA); else if ((oc->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW) - sc_ep_clr(cs, CS_EP_WAIT_DATA); + sc_ep_clr(cs, SE_FL_WAIT_DATA); /* update OC timeouts and wake the other side up if it's waiting for room */ if (oc->flags & CF_WRITE_ACTIVITY) { @@ -1155,14 +1155,14 @@ static void cs_notify(struct conn_stream *cs) * are output data, but we avoid doing this if some of the data are * not yet scheduled for being forwarded, because it is very likely * that it will be done again immediately afterwards once the following - * data are parsed (eg: HTTP chunking). We only CS_EP_RXBLK_ROOM once + * data are parsed (eg: HTTP chunking). We only SE_FL_RXBLK_ROOM once * we've emptied *some* of the output buffer, and not just when there * is available room, because applets are often forced to stop before * the buffer is full. We must not stop based on input data alone because * an HTTP parser might need more data to complete the parsing. */ if (!channel_is_empty(ic) && - sc_ep_test(cso, CS_EP_WAIT_DATA) && + sc_ep_test(cso, SE_FL_WAIT_DATA) && (!(ic->flags & CF_EXPECT_MORE) || c_full(ic) || ci_data(ic) == 0 || ic->pipe)) { int new_len, last_len; @@ -1202,7 +1202,7 @@ static void cs_notify(struct conn_stream *cs) if (/* changes on the production side */ (ic->flags & (CF_READ_NULL|CF_READ_ERROR)) || !cs_state_in(cs->state, CS_SB_CON|CS_SB_RDY|CS_SB_EST) || - sc_ep_test(cs, CS_EP_ERROR) || + sc_ep_test(cs, SE_FL_ERROR) || ((ic->flags & CF_READ_PARTIAL) && ((ic->flags & CF_EOI) || !ic->to_forward || cso->state != CS_ST_EST)) || @@ -1313,7 +1313,7 @@ static int cs_conn_recv(struct conn_stream *cs) return 0; /* stop here if we reached the end of data */ - if (sc_ep_test(cs, CS_EP_EOS)) + if (sc_ep_test(cs, SE_FL_EOS)) goto end_recv; /* stop immediately on errors. Note that we DON'T want to stop on @@ -1322,15 +1322,15 @@ static int cs_conn_recv(struct conn_stream *cs) * happens when we send too large a request to a backend server * which rejects it before reading it all. */ - if (!sc_ep_test(cs, CS_EP_RCV_MORE)) { + if (!sc_ep_test(cs, SE_FL_RCV_MORE)) { if (!conn_xprt_ready(conn)) return 0; - if (sc_ep_test(cs, CS_EP_ERROR)) + if (sc_ep_test(cs, SE_FL_ERROR)) goto end_recv; } /* prepare to detect if the mux needs more room */ - sc_ep_clr(cs, CS_EP_WANT_ROOM); + sc_ep_clr(cs, SE_FL_WANT_ROOM); if ((ic->flags & (CF_STREAMER | CF_STREAMER_FAST)) && !co_data(ic) && global.tune.idle_timer && @@ -1347,7 +1347,7 @@ static int cs_conn_recv(struct conn_stream *cs) /* First, let's see if we may splice data across the channel without * using a buffer. */ - if (sc_ep_test(cs, CS_EP_MAY_SPLICE) && + if (sc_ep_test(cs, SE_FL_MAY_SPLICE) && (ic->pipe || ic->to_forward >= MIN_SPLICE_FORWARD) && ic->flags & CF_KERN_SPLICING) { if (c_data(ic)) { @@ -1382,7 +1382,7 @@ static int cs_conn_recv(struct conn_stream *cs) ic->flags |= CF_READ_PARTIAL; } - if (sc_ep_test(cs, CS_EP_EOS | CS_EP_ERROR)) + if (sc_ep_test(cs, SE_FL_EOS | SE_FL_ERROR)) goto end_recv; if (conn->flags & CO_FL_WAIT_ROOM) { @@ -1402,7 +1402,7 @@ static int cs_conn_recv(struct conn_stream *cs) ic->pipe = NULL; } - if (ic->pipe && ic->to_forward && !(flags & CO_RFL_BUF_FLUSH) && sc_ep_test(cs, CS_EP_MAY_SPLICE)) { + if (ic->pipe && ic->to_forward && !(flags & CO_RFL_BUF_FLUSH) && sc_ep_test(cs, SE_FL_MAY_SPLICE)) { /* don't break splicing by reading, but still call rcv_buf() * to pass the flag. */ @@ -1437,9 +1437,9 @@ static int cs_conn_recv(struct conn_stream *cs) * that if such an event is not handled above in splice, it will be handled here by * recv(). */ - while (sc_ep_test(cs, CS_EP_RCV_MORE) || + while (sc_ep_test(cs, SE_FL_RCV_MORE) || (!(conn->flags & CO_FL_HANDSHAKE) && - (!sc_ep_test(cs, CS_EP_ERROR | CS_EP_EOS)) && !(ic->flags & CF_SHUTR))) { + (!sc_ep_test(cs, SE_FL_ERROR | SE_FL_EOS)) && !(ic->flags & CF_SHUTR))) { int cur_flags = flags; /* Compute transient CO_RFL_* flags */ @@ -1448,13 +1448,13 @@ static int cs_conn_recv(struct conn_stream *cs) } /* may be null. This is the mux responsibility to set - * CS_EP_RCV_MORE on the CS if more space is needed. + * SE_FL_RCV_MORE on the CS if more space is needed. */ max = channel_recv_max(ic); ret = conn->mux->rcv_buf(cs, &ic->buf, max, cur_flags); - if (sc_ep_test(cs, CS_EP_WANT_ROOM)) { - /* CS_EP_WANT_ROOM must not be reported if the channel's + if (sc_ep_test(cs, SE_FL_WANT_ROOM)) { + /* SE_FL_WANT_ROOM must not be reported if the channel's * buffer is empty. */ BUG_ON(c_empty(ic)); @@ -1498,7 +1498,7 @@ static int cs_conn_recv(struct conn_stream *cs) * the channel's policies.This way, we are still able to receive * shutdowns. */ - if (sc_ep_test(cs, CS_EP_EOI)) + if (sc_ep_test(cs, SE_FL_EOI)) break; if ((ic->flags & CF_READ_DONTWAIT) || --read_poll <= 0) { @@ -1584,14 +1584,14 @@ static int cs_conn_recv(struct conn_stream *cs) /* Report EOI on the channel if it was reached from the mux point of * view. */ - if (sc_ep_test(cs, CS_EP_EOI) && !(ic->flags & CF_EOI)) { + if (sc_ep_test(cs, SE_FL_EOI) && !(ic->flags & CF_EOI)) { ic->flags |= (CF_EOI|CF_READ_PARTIAL); ret = 1; } - if (sc_ep_test(cs, CS_EP_ERROR)) + if (sc_ep_test(cs, SE_FL_ERROR)) ret = 1; - else if (sc_ep_test(cs, CS_EP_EOS)) { + else if (sc_ep_test(cs, SE_FL_EOS)) { /* we received a shutdown */ ic->flags |= CF_READ_NULL; if (ic->flags & CF_AUTO_CLOSE) @@ -1648,16 +1648,16 @@ static int cs_conn_send(struct conn_stream *cs) int ret; int did_send = 0; - if (sc_ep_test(cs, CS_EP_ERROR | CS_EP_ERR_PENDING) || cs_is_conn_error(cs)) { + if (sc_ep_test(cs, SE_FL_ERROR | SE_FL_ERR_PENDING) || cs_is_conn_error(cs)) { /* We're probably there because the tasklet was woken up, * but process_stream() ran before, detected there were an * error and put the CS back to CS_ST_TAR. There's still * CO_FL_ERROR on the connection but we don't want to add - * CS_EP_ERROR back, so give up + * SE_FL_ERROR back, so give up */ if (cs->state < CS_ST_CON) return 0; - sc_ep_set(cs, CS_EP_ERROR); + sc_ep_set(cs, SE_FL_ERROR); return 1; } @@ -1770,8 +1770,8 @@ static int cs_conn_send(struct conn_stream *cs) cs_rx_room_rdy(cs_opposite(cs)); } - if (sc_ep_test(cs, CS_EP_ERROR | CS_EP_ERR_PENDING)) { - sc_ep_set(cs, CS_EP_ERROR); + if (sc_ep_test(cs, SE_FL_ERROR | SE_FL_ERR_PENDING)) { + sc_ep_set(cs, SE_FL_ERROR); return 1; } @@ -1826,11 +1826,11 @@ static int cs_conn_process(struct conn_stream *cs) /* First step, report to the conn-stream what was detected at the * connection layer : errors and connection establishment. - * Only add CS_EP_ERROR if we're connected, or we're attempting to + * Only add SE_FL_ERROR if we're connected, or we're attempting to * connect, we may get there because we got woken up, but only run * after process_stream() noticed there were an error, and decided * to retry to connect, the connection may still have CO_FL_ERROR, - * and we don't want to add CS_EP_ERROR back + * and we don't want to add SE_FL_ERROR back * * Note: This test is only required because cs_conn_process is also the SI * wake callback. Otherwise cs_conn_recv()/cs_conn_send() already take @@ -1839,7 +1839,7 @@ static int cs_conn_process(struct conn_stream *cs) if (cs->state >= CS_ST_CON) { if (cs_is_conn_error(cs)) - sc_ep_set(cs, CS_EP_ERROR); + sc_ep_set(cs, SE_FL_ERROR); } /* If we had early data, and the handshake ended, then @@ -1848,8 +1848,8 @@ static int cs_conn_process(struct conn_stream *cs) * the handshake. */ if (!(conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_HS)) && - sc_ep_test(cs, CS_EP_WAIT_FOR_HS)) { - sc_ep_clr(cs, CS_EP_WAIT_FOR_HS); + sc_ep_test(cs, SE_FL_WAIT_FOR_HS)) { + sc_ep_clr(cs, SE_FL_WAIT_FOR_HS); task_wakeup(cs_strm_task(cs), TASK_WOKEN_MSG); } @@ -1868,7 +1868,7 @@ static int cs_conn_process(struct conn_stream *cs) * wake callback. Otherwise cs_conn_recv()/cs_conn_send() already take * care of it. */ - if (sc_ep_test(cs, CS_EP_EOS) && !(ic->flags & CF_SHUTR)) { + if (sc_ep_test(cs, SE_FL_EOS) && !(ic->flags & CF_SHUTR)) { /* we received a shutdown */ ic->flags |= CF_READ_NULL; if (ic->flags & CF_AUTO_CLOSE) @@ -1883,7 +1883,7 @@ static int cs_conn_process(struct conn_stream *cs) * wake callback. Otherwise cs_conn_recv()/cs_conn_send() already take * care of it. */ - if (sc_ep_test(cs, CS_EP_EOI) && !(ic->flags & CF_EOI)) + if (sc_ep_test(cs, SE_FL_EOI) && !(ic->flags & CF_EOI)) ic->flags |= (CF_EOI|CF_READ_PARTIAL); /* Second step : update the conn-stream and channels, try to forward any @@ -1933,8 +1933,8 @@ static int cs_applet_process(struct conn_stream *cs) /* If the applet wants to write and the channel is closed, it's a * broken pipe and it must be reported. */ - if (!sc_ep_test(cs, CS_EP_RX_WAIT_EP) && (ic->flags & CF_SHUTR)) - sc_ep_set(cs, CS_EP_ERROR); + if (!sc_ep_test(cs, SE_FL_RX_WAIT_EP) && (ic->flags & CF_SHUTR)) + sc_ep_set(cs, SE_FL_ERROR); /* automatically mark the applet having data available if it reported * begin blocked by the channel. diff --git a/src/hlua.c b/src/hlua.c index 0b03befec..8ba4fbf79 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -9615,7 +9615,7 @@ void hlua_applet_http_fct(struct appctx *ctx) res_htx->flags |= HTX_FL_EOM; res->flags |= CF_EOI; - se_fl_set(ctx->endp, CS_EP_EOI); + se_fl_set(ctx->endp, SE_FL_EOI); strm->txn->status = http_ctx->status; http_ctx->flags |= APPLET_RSP_SENT; } diff --git a/src/http_ana.c b/src/http_ana.c index 26edaa055..db18da7c2 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -1268,7 +1268,7 @@ static __inline int do_l7_retry(struct stream *s, struct conn_stream *cs) s->flags |= SF_ERR_INTERNAL; return -1; } - sc_ep_clr(cs, CS_EP_RXBLK_SHUT); + sc_ep_clr(cs, SE_FL_RXBLK_SHUT); b_free(&req->buf); /* Swap the L7 buffer with the channel buffer */ @@ -5172,7 +5172,7 @@ struct http_txn *http_create_txn(struct stream *s) return NULL; s->txn = txn; - txn->flags = ((cs && sc_ep_test(cs, CS_EP_NOT_FIRST)) ? TX_NOT_FIRST : 0); + txn->flags = ((cs && sc_ep_test(cs, SE_FL_NOT_FIRST)) ? TX_NOT_FIRST : 0); txn->status = -1; txn->http_reply = NULL; txn->l7_buffer = BUF_NULL; diff --git a/src/http_client.c b/src/http_client.c index 520f5f10b..67427d5de 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -733,7 +733,7 @@ static void httpclient_applet_io_handler(struct appctx *appctx) if (htx->flags & HTX_FL_EOM) { req->flags |= CF_EOI; se_fl_set(appctx->endp, - CS_EP_EOI); + SE_FL_EOI); appctx->st0 = HTTPCLIENT_S_RES_STLINE; } diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index 3ceec9c78..8a7516957 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -373,7 +373,7 @@ static int fcgi_strm_send_abort(struct fcgi_conn *fconn, struct fcgi_strm *fstrm /* a dummy closed endpoint */ static const struct cs_endpoint closed_ep = { . cs = NULL, - .flags = CS_EP_DETACHED, + .flags = SE_FL_DETACHED, }; /* a dmumy management stream */ @@ -1007,7 +1007,7 @@ static inline void fcgi_strm_close(struct fcgi_strm *fstrm) if (!fstrm->id) fstrm->fconn->nb_reserved--; if (fstrm->endp->cs) { - if (!se_fl_test(fstrm->endp, CS_EP_EOS) && !b_data(&fstrm->rxbuf)) + if (!se_fl_test(fstrm->endp, SE_FL_EOS) && !b_data(&fstrm->rxbuf)) fcgi_strm_notify_recv(fstrm); } fstrm->state = FCGI_SS_CLOSED; @@ -1039,7 +1039,7 @@ static void fcgi_strm_destroy(struct fcgi_strm *fstrm) */ LIST_DEL_INIT(&fstrm->send_list); tasklet_free(fstrm->shut_tl); - BUG_ON(fstrm->endp && !se_fl_test(fstrm->endp, CS_EP_ORPHAN)); + BUG_ON(fstrm->endp && !se_fl_test(fstrm->endp, SE_FL_ORPHAN)); cs_endpoint_free(fstrm->endp); pool_free(pool_head_fcgi_strm, fstrm); @@ -1144,8 +1144,8 @@ static struct fcgi_strm *fcgi_conn_stream_new(struct fcgi_conn *fconn, struct co return NULL; } -/* Wakes a specific stream and assign its conn_stream some CS_EP_* flags among - * CS_EP_ERR_PENDING and CS_EP_ERROR if needed. The stream's state is +/* Wakes a specific stream and assign its conn_stream some SE_FL_* flags among + * SE_FL_ERR_PENDING and SE_FL_ERROR if needed. The stream's state is * automatically updated accordingly. If the stream is orphaned, it is * destroyed. */ @@ -1172,9 +1172,9 @@ static void fcgi_strm_wake_one_stream(struct fcgi_strm *fstrm) } if ((fconn->state == FCGI_CS_CLOSED || fconn->conn->flags & CO_FL_ERROR)) { - se_fl_set(fstrm->endp, CS_EP_ERR_PENDING); - if (se_fl_test(fstrm->endp, CS_EP_EOS)) - se_fl_set(fstrm->endp, CS_EP_ERROR); + se_fl_set(fstrm->endp, SE_FL_ERR_PENDING); + if (se_fl_test(fstrm->endp, SE_FL_EOS)) + se_fl_set(fstrm->endp, SE_FL_ERROR); if (fstrm->state < FCGI_SS_ERROR) { fstrm->state = FCGI_SS_ERROR; @@ -2622,10 +2622,10 @@ static void fcgi_process_demux(struct fcgi_conn *fconn) fcgi_conn_read0_pending(fconn) || fstrm->state == FCGI_SS_CLOSED || (fstrm->flags & FCGI_SF_ES_RCVD) || - se_fl_test(fstrm->endp, CS_EP_ERROR | CS_EP_ERR_PENDING | CS_EP_EOS))) { + se_fl_test(fstrm->endp, SE_FL_ERROR | SE_FL_ERR_PENDING | SE_FL_EOS))) { /* we may have to signal the upper layers */ TRACE_DEVEL("notifying stream before switching SID", FCGI_EV_RX_RECORD|FCGI_EV_STRM_WAKE, fconn->conn, fstrm); - se_fl_set(fstrm->endp, CS_EP_RCV_MORE); + se_fl_set(fstrm->endp, SE_FL_RCV_MORE); fcgi_strm_notify_recv(fstrm); } fstrm = tmp_fstrm; @@ -2703,10 +2703,10 @@ static void fcgi_process_demux(struct fcgi_conn *fconn) fcgi_conn_read0_pending(fconn) || fstrm->state == FCGI_SS_CLOSED || (fstrm->flags & FCGI_SF_ES_RCVD) || - se_fl_test(fstrm->endp, CS_EP_ERROR | CS_EP_ERR_PENDING | CS_EP_EOS))) { + se_fl_test(fstrm->endp, SE_FL_ERROR | SE_FL_ERR_PENDING | SE_FL_EOS))) { /* we may have to signal the upper layers */ TRACE_DEVEL("notifying stream before switching SID", FCGI_EV_RX_RECORD|FCGI_EV_STRM_WAKE, fconn->conn, fstrm); - se_fl_set(fstrm->endp, CS_EP_RCV_MORE); + se_fl_set(fstrm->endp, SE_FL_RCV_MORE); fcgi_strm_notify_recv(fstrm); } @@ -3118,7 +3118,7 @@ static int fcgi_process(struct fcgi_conn *fconn) while (node) { fstrm = container_of(node, struct fcgi_strm, by_id); - if (fstrm->endp->cs && se_fl_test(fstrm->endp, CS_EP_WAIT_FOR_HS)) + if (fstrm->endp->cs && se_fl_test(fstrm->endp, SE_FL_WAIT_FOR_HS)) fcgi_strm_notify_recv(fstrm); node = eb32_next(node); } @@ -3722,7 +3722,7 @@ static void fcgi_do_shutr(struct fcgi_strm *fstrm) * for example because of a "tcp-request content reject" rule that is * normally used to limit abuse. */ - if (se_fl_test(fstrm->endp, CS_EP_KILL_CONN) && + if (se_fl_test(fstrm->endp, SE_FL_KILL_CONN) && !(fconn->flags & (FCGI_CF_ABRTS_SENT|FCGI_CF_ABRTS_FAILED))) { TRACE_STATE("stream wants to kill the connection", FCGI_EV_STRM_SHUT, fconn->conn, fstrm); fconn->state = FCGI_CS_CLOSED; @@ -3783,7 +3783,7 @@ static void fcgi_do_shutw(struct fcgi_strm *fstrm) * for example because of a "tcp-request content reject" rule that is * normally used to limit abuse. */ - if (se_fl_test(fstrm->endp, CS_EP_KILL_CONN) && + if (se_fl_test(fstrm->endp, SE_FL_KILL_CONN) && !(fconn->flags & (FCGI_CF_ABRTS_SENT|FCGI_CF_ABRTS_FAILED))) { TRACE_STATE("stream wants to kill the connection", FCGI_EV_STRM_SHUT, fconn->conn, fstrm); fconn->state = FCGI_CS_CLOSED; @@ -3953,18 +3953,18 @@ static size_t fcgi_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t co TRACE_STATE("fstrm rxbuf not allocated", FCGI_EV_STRM_RECV|FCGI_EV_FSTRM_BLK, fconn->conn, fstrm); if (b_data(&fstrm->rxbuf)) - se_fl_set(fstrm->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); + se_fl_set(fstrm->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); else { - se_fl_clr(fstrm->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); + se_fl_clr(fstrm->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); if (fstrm->state == FCGI_SS_ERROR || (fstrm->h1m.state == H1_MSG_DONE)) { - se_fl_set(fstrm->endp, CS_EP_EOI); + se_fl_set(fstrm->endp, SE_FL_EOI); if (!(fstrm->h1m.flags & (H1_MF_VER_11|H1_MF_XFER_LEN))) - se_fl_set(fstrm->endp, CS_EP_EOS); + se_fl_set(fstrm->endp, SE_FL_EOS); } if (fcgi_conn_read0_pending(fconn)) - se_fl_set(fstrm->endp, CS_EP_EOS); - if (se_fl_test(fstrm->endp, CS_EP_ERR_PENDING)) - se_fl_set(fstrm->endp, CS_EP_ERROR); + se_fl_set(fstrm->endp, SE_FL_EOS); + if (se_fl_test(fstrm->endp, SE_FL_ERR_PENDING)) + se_fl_set(fstrm->endp, SE_FL_ERROR); fcgi_release_buf(fconn, &fstrm->rxbuf); } @@ -4017,7 +4017,7 @@ static size_t fcgi_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t co if (id < 0) { fcgi_strm_close(fstrm); - se_fl_set(fstrm->endp, CS_EP_ERROR); + se_fl_set(fstrm->endp, SE_FL_ERROR); TRACE_DEVEL("couldn't get a stream ID, leaving in error", FCGI_EV_STRM_SEND|FCGI_EV_FSTRM_ERR|FCGI_EV_STRM_ERR, fconn->conn, fstrm); return 0; } @@ -4188,7 +4188,7 @@ static int fcgi_show_fd(struct buffer *msg, struct connection *conn) fstrm->endp->cs); if (fstrm->endp) { chunk_appendf(msg, " .endp.flg=0x%08x", se_fl_get(fstrm->endp)); - if (!se_fl_test(fstrm->endp, CS_EP_ORPHAN)) + if (!se_fl_test(fstrm->endp, SE_FL_ORPHAN)) chunk_appendf(msg, " .cs.flg=0x%08x .cs.app=%p", fstrm->endp->cs->flags, fstrm->endp->cs->app); } diff --git a/src/mux_h1.c b/src/mux_h1.c index 91aee7fd4..3caee7c82 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -722,9 +722,9 @@ static struct conn_stream *h1s_new_cs(struct h1s *h1s, struct buffer *input) TRACE_ENTER(H1_EV_STRM_NEW, h1c->conn, h1s); if (h1s->flags & H1S_F_NOT_FIRST) - se_fl_set(h1s->endp, CS_EP_NOT_FIRST); + se_fl_set(h1s->endp, SE_FL_NOT_FIRST); if (h1s->req.flags & H1_MF_UPG_WEBSOCKET) - se_fl_set(h1s->endp, CS_EP_WEBSOCKET); + se_fl_set(h1s->endp, SE_FL_WEBSOCKET); if (!cs_new_from_endp(h1s->endp, h1c->conn->owner, input)) { TRACE_ERROR("CS allocation failure", H1_EV_STRM_NEW|H1_EV_STRM_END|H1_EV_STRM_ERR, h1c->conn, h1s); @@ -823,7 +823,7 @@ static struct h1s *h1c_frt_stream_new(struct h1c *h1c, struct conn_stream *cs, s goto fail; h1s->endp->target = h1s; h1s->endp->conn = h1c->conn; - se_fl_set(h1s->endp, CS_EP_T_MUX | CS_EP_ORPHAN); + se_fl_set(h1s->endp, SE_FL_T_MUX | SE_FL_ORPHAN); } h1s->sess = sess; @@ -911,7 +911,7 @@ static void h1s_destroy(struct h1s *h1s) } HA_ATOMIC_DEC(&h1c->px_counters->open_streams); - BUG_ON(h1s->endp && !se_fl_test(h1s->endp, CS_EP_ORPHAN)); + BUG_ON(h1s->endp && !se_fl_test(h1s->endp, SE_FL_ORPHAN)); cs_endpoint_free(h1s->endp); pool_free(pool_head_h1s, h1s); } @@ -1906,11 +1906,11 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count /* Here h1s->endp->cs is always defined */ if (!(h1m->flags & H1_MF_CHNK) && (h1m->state == H1_MSG_DATA || (h1m->state == H1_MSG_TUNNEL))) { TRACE_STATE("notify the mux can use splicing", H1_EV_RX_DATA|H1_EV_RX_BODY, h1c->conn, h1s); - se_fl_set(h1s->endp, CS_EP_MAY_SPLICE); + se_fl_set(h1s->endp, SE_FL_MAY_SPLICE); } else { TRACE_STATE("notify the mux can't use splicing anymore", H1_EV_RX_DATA|H1_EV_RX_BODY, h1c->conn, h1s); - se_fl_clr(h1s->endp, CS_EP_MAY_SPLICE); + se_fl_clr(h1s->endp, SE_FL_MAY_SPLICE); } /* Set EOI on conn-stream in DONE state iff: @@ -1922,7 +1922,7 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count */ if (((h1m->state == H1_MSG_DONE) && (h1m->flags & H1_MF_RESP)) || ((h1m->state == H1_MSG_DONE) && (h1s->meth != HTTP_METH_CONNECT) && !(h1m->flags & H1_MF_CONN_UPG))) - se_fl_set(h1s->endp, CS_EP_EOI); + se_fl_set(h1s->endp, SE_FL_EOI); out: /* When Input data are pending for this message, notify upper layer that @@ -1932,20 +1932,20 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count * - Headers or trailers are pending to be copied. */ if (h1s->flags & (H1S_F_RX_CONGESTED)) { - se_fl_set(h1s->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); + se_fl_set(h1s->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); TRACE_STATE("waiting for more room", H1_EV_RX_DATA|H1_EV_H1S_BLK, h1c->conn, h1s); } else { - se_fl_clr(h1s->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); + se_fl_clr(h1s->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); if (h1s->flags & H1S_F_REOS) { - se_fl_set(h1s->endp, CS_EP_EOS); + se_fl_set(h1s->endp, SE_FL_EOS); if (h1m->state >= H1_MSG_DONE || !(h1m->flags & H1_MF_XFER_LEN)) { /* DONE or TUNNEL or SHUTR without XFER_LEN, set * EOI on the conn-stream */ - se_fl_set(h1s->endp, CS_EP_EOI); + se_fl_set(h1s->endp, SE_FL_EOI); } else if (h1m->state > H1_MSG_LAST_LF && h1m->state < H1_MSG_DONE) { - se_fl_set(h1s->endp, CS_EP_ERROR); + se_fl_set(h1s->endp, SE_FL_ERROR); TRACE_ERROR("message aborted, set error on CS", H1_EV_RX_DATA|H1_EV_H1S_ERR, h1c->conn, h1s); } @@ -1963,7 +1963,7 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count err: htx_to_buf(htx, buf); - se_fl_set(h1s->endp, CS_EP_EOI); + se_fl_set(h1s->endp, SE_FL_EOI); TRACE_DEVEL("leaving on error", H1_EV_RX_DATA|H1_EV_STRM_ERR, h1c->conn, h1s); return 0; } @@ -2572,7 +2572,7 @@ static size_t h1_process_mux(struct h1c *h1c, struct buffer *buf, size_t count) h1c->flags |= H1C_F_ST_ERROR; TRACE_ERROR("txn done but data waiting to be sent, set error on h1c", H1_EV_H1C_ERR, h1c->conn, h1s); } - se_fl_set(h1s->endp, CS_EP_EOI); + se_fl_set(h1s->endp, SE_FL_EOI); } TRACE_LEAVE(H1_EV_TX_DATA, h1c->conn, h1s, chn_htx, (size_t[]){total}); @@ -3053,7 +3053,7 @@ static int h1_process(struct h1c * h1c) TRACE_STATE("read0 on connection", H1_EV_H1C_RECV, conn, h1s); } if ((h1c->flags & H1C_F_ST_ERROR) || ((conn->flags & CO_FL_ERROR) && !b_data(&h1c->ibuf))) - se_fl_set(h1s->endp, CS_EP_ERROR); + se_fl_set(h1s->endp, SE_FL_ERROR); TRACE_POINT(H1_EV_STRM_WAKE, h1c->conn, h1s); h1_alert(h1s); } @@ -3109,9 +3109,9 @@ static int h1_process(struct h1c * h1c) BUG_ON(!h1s || h1c->flags & H1C_F_ST_READY); if (conn_xprt_read0_pending(conn) || (h1s->flags & H1S_F_REOS)) - se_fl_set(h1s->endp, CS_EP_EOS); + se_fl_set(h1s->endp, SE_FL_EOS); if ((h1c->flags & H1C_F_ST_ERROR) || (conn->flags & CO_FL_ERROR)) - se_fl_set(h1s->endp, CS_EP_ERROR); + se_fl_set(h1s->endp, SE_FL_ERROR); h1_alert(h1s); TRACE_DEVEL("waiting to release the CS before releasing the connection", H1_EV_H1C_WAKE); } @@ -3263,7 +3263,7 @@ struct task *h1_timeout_task(struct task *t, void *context, unsigned int state) if (h1c->flags & H1C_F_ST_ATTACHED) { /* Don't release the H1 connection right now, we must destroy the * attached CS first. Here, the H1C must not be READY */ - se_fl_set(h1c->h1s->endp, CS_EP_EOS | CS_EP_ERROR); + se_fl_set(h1c->h1s->endp, SE_FL_EOS | SE_FL_ERROR); h1_alert(h1c->h1s); h1_refresh_timeout(h1c); HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conns[tid].idle_conns_lock); @@ -3475,9 +3475,9 @@ static void h1_shutr(struct conn_stream *cs, enum co_shr_mode mode) TRACE_ENTER(H1_EV_STRM_SHUT, h1c->conn, h1s, 0, (size_t[]){mode}); - if (se_fl_test(h1s->endp, CS_EP_SHR)) + if (se_fl_test(h1s->endp, SE_FL_SHR)) goto end; - if (se_fl_test(h1s->endp, CS_EP_KILL_CONN)) { + if (se_fl_test(h1s->endp, SE_FL_KILL_CONN)) { TRACE_STATE("stream wants to kill the connection", H1_EV_STRM_SHUT, h1c->conn, h1s); goto do_shutr; } @@ -3498,7 +3498,7 @@ static void h1_shutr(struct conn_stream *cs, enum co_shr_mode mode) do_shutr: /* NOTE: Be sure to handle abort (cf. h2_shutr) */ - if (se_fl_test(h1s->endp, CS_EP_SHR)) + if (se_fl_test(h1s->endp, SE_FL_SHR)) goto end; if (conn_xprt_ready(h1c->conn) && h1c->conn->xprt->shutr) @@ -3518,9 +3518,9 @@ static void h1_shutw(struct conn_stream *cs, enum co_shw_mode mode) TRACE_ENTER(H1_EV_STRM_SHUT, h1c->conn, h1s, 0, (size_t[]){mode}); - if (se_fl_test(h1s->endp, CS_EP_SHW)) + if (se_fl_test(h1s->endp, SE_FL_SHW)) goto end; - if (se_fl_test(h1s->endp, CS_EP_KILL_CONN)) { + if (se_fl_test(h1s->endp, SE_FL_KILL_CONN)) { TRACE_STATE("stream wants to kill the connection", H1_EV_STRM_SHUT, h1c->conn, h1s); goto do_shutw; } @@ -3664,7 +3664,7 @@ static size_t h1_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun else TRACE_DEVEL("h1c ibuf not allocated", H1_EV_H1C_RECV|H1_EV_H1C_BLK, h1c->conn); - if ((flags & CO_RFL_BUF_FLUSH) && se_fl_test(h1s->endp, CS_EP_MAY_SPLICE)) { + if ((flags & CO_RFL_BUF_FLUSH) && se_fl_test(h1s->endp, SE_FL_MAY_SPLICE)) { h1c->flags |= H1C_F_WANT_SPLICE; TRACE_STATE("Block xprt rcv_buf to flush stream's buffer (want_splice)", H1_EV_STRM_RECV, h1c->conn, h1s); } @@ -3702,7 +3702,7 @@ static size_t h1_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun } if (h1c->flags & H1C_F_ST_ERROR) { - se_fl_set(h1s->endp, CS_EP_ERROR); + se_fl_set(h1s->endp, SE_FL_ERROR); TRACE_ERROR("H1C on error, leaving in error", H1_EV_STRM_SEND|H1_EV_H1C_ERR|H1_EV_H1S_ERR|H1_EV_STRM_ERR, h1c->conn, h1s); return 0; } @@ -3734,7 +3734,7 @@ static size_t h1_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun } if (h1c->flags & H1C_F_ST_ERROR) { - se_fl_set(h1s->endp, CS_EP_ERROR); + se_fl_set(h1s->endp, SE_FL_ERROR); TRACE_ERROR("reporting error to the app-layer stream", H1_EV_STRM_SEND|H1_EV_H1S_ERR|H1_EV_STRM_ERR, h1c->conn, h1s); } @@ -3779,7 +3779,7 @@ static int h1_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int c if (ret > h1m->curr_len) { h1s->flags |= H1S_F_PARSING_ERROR; h1c->flags |= H1C_F_ST_ERROR; - se_fl_set(h1s->endp, CS_EP_ERROR); + se_fl_set(h1s->endp, SE_FL_ERROR); TRACE_ERROR("too much payload, more than announced", H1_EV_RX_DATA|H1_EV_STRM_ERR|H1_EV_H1C_ERR|H1_EV_H1S_ERR, h1c->conn, h1s); goto end; @@ -3804,7 +3804,7 @@ static int h1_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned int c if (!(h1c->flags & H1C_F_WANT_SPLICE)) { TRACE_STATE("notify the mux can't use splicing anymore", H1_EV_STRM_RECV, h1c->conn, h1s); - se_fl_clr(h1s->endp, CS_EP_MAY_SPLICE); + se_fl_clr(h1s->endp, SE_FL_MAY_SPLICE); if (!(h1c->wait_event.events & SUB_RETRY_RECV)) { TRACE_STATE("restart receiving data, subscribing", H1_EV_STRM_RECV, h1c->conn, h1s); h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event); @@ -3837,7 +3837,7 @@ static int h1_snd_pipe(struct conn_stream *cs, struct pipe *pipe) if (ret > h1m->curr_len) { h1s->flags |= H1S_F_PROCESSING_ERROR; h1c->flags |= H1C_F_ST_ERROR; - se_fl_set(h1s->endp, CS_EP_ERROR); + se_fl_set(h1s->endp, SE_FL_ERROR); TRACE_ERROR("too much payload, more than announced", H1_EV_TX_DATA|H1_EV_STRM_ERR|H1_EV_H1C_ERR|H1_EV_H1S_ERR, h1c->conn, h1s); goto end; @@ -3910,7 +3910,7 @@ static int h1_show_fd(struct buffer *msg, struct connection *conn) if (h1s->endp) { chunk_appendf(msg, " .endp.flg=0x%08x", se_fl_get(h1s->endp)); - if (!se_fl_test(h1s->endp, CS_EP_ORPHAN)) + if (!se_fl_test(h1s->endp, SE_FL_ORPHAN)) chunk_appendf(msg, " .cs.flg=0x%08x .cs.app=%p", h1s->endp->cs->flags, h1s->endp->cs->app); } diff --git a/src/mux_h2.c b/src/mux_h2.c index 25969c90c..935d61125 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -525,7 +525,7 @@ static int h2_settings_max_frame_size = 0; /* unset */ /* a dummy closed endpoint */ static const struct cs_endpoint closed_ep = { . cs = NULL, - .flags = CS_EP_DETACHED, + .flags = SE_FL_DETACHED, }; /* a dmumy closed stream */ @@ -1485,7 +1485,7 @@ static inline void h2s_close(struct h2s *h2s) if (!h2s->id) h2s->h2c->nb_reserved--; if (h2s->endp->cs) { - if (!se_fl_test(h2s->endp, CS_EP_EOS) && !b_data(&h2s->rxbuf)) + if (!se_fl_test(h2s->endp, SE_FL_EOS) && !b_data(&h2s->rxbuf)) h2s_notify_recv(h2s); } HA_ATOMIC_DEC(&h2s->h2c->px_counters->open_streams); @@ -1524,7 +1524,7 @@ static void h2s_destroy(struct h2s *h2s) /* ditto, calling tasklet_free() here should be ok */ tasklet_free(h2s->shut_tl); - BUG_ON(h2s->endp && !se_fl_test(h2s->endp, CS_EP_ORPHAN)); + BUG_ON(h2s->endp && !se_fl_test(h2s->endp, SE_FL_ORPHAN)); cs_endpoint_free(h2s->endp); pool_free(pool_head_h2s, h2s); @@ -1614,13 +1614,13 @@ static struct h2s *h2c_frt_stream_new(struct h2c *h2c, int id, struct buffer *in goto out_close; h2s->endp->target = h2s; h2s->endp->conn = h2c->conn; - se_fl_set(h2s->endp, CS_EP_T_MUX | CS_EP_ORPHAN | CS_EP_NOT_FIRST); + se_fl_set(h2s->endp, SE_FL_T_MUX | SE_FL_ORPHAN | SE_FL_NOT_FIRST); /* FIXME wrong analogy between ext-connect and websocket, this need to * be refine. */ if (flags & H2_SF_EXT_CONNECT_RCVD) - se_fl_set(h2s->endp, CS_EP_WEBSOCKET); + se_fl_set(h2s->endp, SE_FL_WEBSOCKET); /* The stream will record the request's accept date (which is either the * end of the connection's or the date immediately after the previous @@ -2185,8 +2185,8 @@ static int h2_send_empty_data_es(struct h2s *h2s) return ret; } -/* wake a specific stream and assign its conn_stream some CS_EP_* flags among - * CS_EP_ERR_PENDING and CS_EP_ERROR if needed. The stream's state +/* wake a specific stream and assign its conn_stream some SE_FL_* flags among + * SE_FL_ERR_PENDING and SE_FL_ERROR if needed. The stream's state * is automatically updated accordingly. If the stream is orphaned, it is * destroyed. */ @@ -2212,9 +2212,9 @@ static void h2s_wake_one_stream(struct h2s *h2s) if ((h2s->h2c->st0 >= H2_CS_ERROR || h2s->h2c->conn->flags & CO_FL_ERROR) || (h2s->h2c->last_sid > 0 && (!h2s->id || h2s->id > h2s->h2c->last_sid))) { - se_fl_set(h2s->endp, CS_EP_ERR_PENDING); - if (se_fl_test(h2s->endp, CS_EP_EOS)) - se_fl_set(h2s->endp, CS_EP_ERROR); + se_fl_set(h2s->endp, SE_FL_ERR_PENDING); + if (se_fl_test(h2s->endp, SE_FL_EOS)) + se_fl_set(h2s->endp, SE_FL_ERROR); if (h2s->st < H2_SS_ERROR) h2s->st = H2_SS_ERROR; @@ -2978,7 +2978,7 @@ static struct h2s *h2c_bck_handle_headers(struct h2c *h2c, struct h2s *h2s) if (h2c->dff & H2_F_HEADERS_END_STREAM) h2s->flags |= H2_SF_ES_RCVD; - if (se_fl_test(h2s->endp, CS_EP_ERROR) && h2s->st < H2_SS_ERROR) + if (se_fl_test(h2s->endp, SE_FL_ERROR) && h2s->st < H2_SS_ERROR) h2s->st = H2_SS_ERROR; else if (h2s->flags & H2_SF_ES_RCVD) { if (h2s->st == H2_SS_OPEN) @@ -3479,10 +3479,10 @@ static void h2_process_demux(struct h2c *h2c) h2c_read0_pending(h2c) || h2s->st == H2_SS_CLOSED || (h2s->flags & H2_SF_ES_RCVD) || - se_fl_test(h2s->endp, CS_EP_ERROR | CS_EP_ERR_PENDING | CS_EP_EOS))) { + se_fl_test(h2s->endp, SE_FL_ERROR | SE_FL_ERR_PENDING | SE_FL_EOS))) { /* we may have to signal the upper layers */ TRACE_DEVEL("notifying stream before switching SID", H2_EV_RX_FRAME|H2_EV_STRM_WAKE, h2c->conn, h2s); - se_fl_set(h2s->endp, CS_EP_RCV_MORE); + se_fl_set(h2s->endp, SE_FL_RCV_MORE); h2s_notify_recv(h2s); } h2s = tmp_h2s; @@ -3650,10 +3650,10 @@ static void h2_process_demux(struct h2c *h2c) h2c_read0_pending(h2c) || h2s->st == H2_SS_CLOSED || (h2s->flags & H2_SF_ES_RCVD) || - se_fl_test(h2s->endp, CS_EP_ERROR | CS_EP_ERR_PENDING | CS_EP_EOS))) { + se_fl_test(h2s->endp, SE_FL_ERROR | SE_FL_ERR_PENDING | SE_FL_EOS))) { /* we may have to signal the upper layers */ TRACE_DEVEL("notifying stream before switching SID", H2_EV_RX_FRAME|H2_EV_H2S_WAKE, h2c->conn, h2s); - se_fl_set(h2s->endp, CS_EP_RCV_MORE); + se_fl_set(h2s->endp, SE_FL_RCV_MORE); h2s_notify_recv(h2s); } @@ -4102,7 +4102,7 @@ static int h2_process(struct h2c *h2c) while (node) { h2s = container_of(node, struct h2s, by_id); - if (se_fl_test(h2s->endp, CS_EP_WAIT_FOR_HS)) + if (se_fl_test(h2s->endp, SE_FL_WAIT_FOR_HS)) h2s_notify_recv(h2s); node = eb32_next(node); } @@ -4520,7 +4520,7 @@ static void h2_do_shutr(struct h2s *h2s) * normally used to limit abuse. In this case we schedule a goaway to * close the connection. */ - if (se_fl_test(h2s->endp, CS_EP_KILL_CONN) && + if (se_fl_test(h2s->endp, SE_FL_KILL_CONN) && !(h2c->flags & (H2_CF_GOAWAY_SENT|H2_CF_GOAWAY_FAILED))) { TRACE_STATE("stream wants to kill the connection", H2_EV_STRM_SHUT, h2c->conn, h2s); h2c_error(h2c, H2_ERR_ENHANCE_YOUR_CALM); @@ -4598,7 +4598,7 @@ static void h2_do_shutw(struct h2s *h2s) * normally used to limit abuse. In this case we schedule a goaway to * close the connection. */ - if (se_fl_test(h2s->endp, CS_EP_KILL_CONN) && + if (se_fl_test(h2s->endp, SE_FL_KILL_CONN) && !(h2c->flags & (H2_CF_GOAWAY_SENT|H2_CF_GOAWAY_FAILED))) { TRACE_STATE("stream wants to kill the connection", H2_EV_STRM_SHUT, h2c->conn, h2s); h2c_error(h2c, H2_ERR_ENHANCE_YOUR_CALM); @@ -5022,7 +5022,7 @@ static int h2c_decode_headers(struct h2c *h2c, struct buffer *rxbuf, uint32_t *f /* Transfer the payload of a DATA frame to the HTTP/1 side. The HTTP/2 frame * parser state is automatically updated. Returns > 0 if it could completely * send the current frame, 0 if it couldn't complete, in which case - * CS_EP_RCV_MORE must be checked to know if some data remain pending (an empty + * SE_FL_RCV_MORE must be checked to know if some data remain pending (an empty * DATA frame can return 0 as a valid result). Stream errors are reported in * h2s->errcode and connection errors in h2c->errcode. The caller must already * have checked the frame header and ensured that the frame was complete or the @@ -5338,7 +5338,7 @@ static size_t h2s_frt_make_resp_headers(struct h2s *h2s, struct htx *htx) break; } - if (!h2s->endp->cs || se_fl_test(h2s->endp, CS_EP_SHW)) { + if (!h2s->endp->cs || se_fl_test(h2s->endp, SE_FL_SHW)) { /* Response already closed: add END_STREAM */ es_now = 1; } @@ -5758,7 +5758,7 @@ static size_t h2s_bck_make_req_headers(struct h2s *h2s, struct htx *htx) break; } - if (!h2s->endp->cs || se_fl_test(h2s->endp, CS_EP_SHW)) { + if (!h2s->endp->cs || se_fl_test(h2s->endp, SE_FL_SHW)) { /* Request already closed: add END_STREAM */ es_now = 1; } @@ -6482,7 +6482,7 @@ static size_t h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun if (h2s_htx->flags & HTX_FL_PARSING_ERROR) { buf_htx->flags |= HTX_FL_PARSING_ERROR; if (htx_is_empty(buf_htx)) - se_fl_set(h2s->endp, CS_EP_EOI); + se_fl_set(h2s->endp, SE_FL_EOI); } else if (htx_is_empty(h2s_htx)) buf_htx->flags |= (h2s_htx->flags & HTX_FL_EOM); @@ -6494,19 +6494,19 @@ static size_t h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun end: if (b_data(&h2s->rxbuf)) - se_fl_set(h2s->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); + se_fl_set(h2s->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); else { - se_fl_clr(h2s->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); + se_fl_clr(h2s->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); if (h2s->flags & H2_SF_ES_RCVD) { - se_fl_set(h2s->endp, CS_EP_EOI); + se_fl_set(h2s->endp, SE_FL_EOI); /* Add EOS flag for tunnel */ if (h2s->flags & H2_SF_BODY_TUNNEL) - se_fl_set(h2s->endp, CS_EP_EOS); + se_fl_set(h2s->endp, SE_FL_EOS); } if (h2c_read0_pending(h2c) || h2s->st == H2_SS_CLOSED) - se_fl_set(h2s->endp, CS_EP_EOS); - if (se_fl_test(h2s->endp, CS_EP_ERR_PENDING)) - se_fl_set(h2s->endp, CS_EP_ERROR); + se_fl_set(h2s->endp, SE_FL_EOS); + if (se_fl_test(h2s->endp, SE_FL_ERR_PENDING)) + se_fl_set(h2s->endp, SE_FL_ERROR); if (b_size(&h2s->rxbuf)) { b_free(&h2s->rxbuf); offer_buffers(NULL, 1); @@ -6558,7 +6558,7 @@ static size_t h2_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun } if (h2s->h2c->st0 >= H2_CS_ERROR) { - se_fl_set(h2s->endp, CS_EP_ERROR); + se_fl_set(h2s->endp, SE_FL_ERROR); TRACE_DEVEL("connection is in error, leaving in error", H2_EV_H2S_SEND|H2_EV_H2S_BLK|H2_EV_H2S_ERR|H2_EV_STRM_ERR, h2s->h2c->conn, h2s); return 0; } @@ -6572,7 +6572,7 @@ static size_t h2_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun int32_t id = h2c_get_next_sid(h2s->h2c); if (id < 0) { - se_fl_set(h2s->endp, CS_EP_ERROR); + se_fl_set(h2s->endp, SE_FL_ERROR); TRACE_DEVEL("couldn't get a stream ID, leaving in error", H2_EV_H2S_SEND|H2_EV_H2S_BLK|H2_EV_H2S_ERR|H2_EV_STRM_ERR, h2s->h2c->conn, h2s); return 0; } @@ -6684,10 +6684,10 @@ static size_t h2_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun !b_data(&h2s->h2c->dbuf) && (h2s->flags & (H2_SF_BLK_SFCTL | H2_SF_BLK_MFCTL))) { TRACE_DEVEL("fctl with shutr, reporting error to app-layer", H2_EV_H2S_SEND|H2_EV_STRM_SEND|H2_EV_STRM_ERR, h2s->h2c->conn, h2s); - if (se_fl_test(h2s->endp, CS_EP_EOS)) - se_fl_set(h2s->endp, CS_EP_ERROR); + if (se_fl_test(h2s->endp, SE_FL_EOS)) + se_fl_set(h2s->endp, SE_FL_ERROR); else - se_fl_set(h2s->endp, CS_EP_ERR_PENDING); + se_fl_set(h2s->endp, SE_FL_ERR_PENDING); } if (total > 0 && !(h2s->flags & H2_SF_BLK_SFCTL) && diff --git a/src/mux_pt.c b/src/mux_pt.c index d57e82e37..e93c2d65e 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -208,7 +208,7 @@ static void mux_pt_destroy(struct mux_pt_ctx *ctx) if (conn && ctx->wait_event.events != 0) conn->xprt->unsubscribe(conn, conn->xprt_ctx, ctx->wait_event.events, &ctx->wait_event); - BUG_ON(ctx->endp && !se_fl_test(ctx->endp, CS_EP_ORPHAN)); + BUG_ON(ctx->endp && !se_fl_test(ctx->endp, SE_FL_ORPHAN)); cs_endpoint_free(ctx->endp); pool_free(pool_head_pt_ctx, ctx); @@ -233,7 +233,7 @@ struct task *mux_pt_io_cb(struct task *t, void *tctx, unsigned int status) struct mux_pt_ctx *ctx = tctx; TRACE_ENTER(PT_EV_CONN_WAKE, ctx->conn); - if (!se_fl_test(ctx->endp, CS_EP_ORPHAN)) { + if (!se_fl_test(ctx->endp, SE_FL_ORPHAN)) { /* There's a small race condition. * mux_pt_io_cb() is only supposed to be called if we have no * stream attached. However, maybe the tasklet got woken up, @@ -300,7 +300,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio } ctx->endp->target = ctx; ctx->endp->conn = conn; - se_fl_set(ctx->endp, CS_EP_T_MUX | CS_EP_ORPHAN); + se_fl_set(ctx->endp, SE_FL_T_MUX | SE_FL_ORPHAN); cs = cs_new_from_endp(ctx->endp, sess, input); if (!cs) { @@ -315,9 +315,9 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio ctx->endp = cs->endp; } conn->ctx = ctx; - se_fl_set(ctx->endp, CS_EP_RCV_MORE); + se_fl_set(ctx->endp, SE_FL_RCV_MORE); if (global.tune.options & GTUNE_USE_SPLICE) - se_fl_set(ctx->endp, CS_EP_MAY_SPLICE); + se_fl_set(ctx->endp, SE_FL_MAY_SPLICE); TRACE_LEAVE(PT_EV_CONN_NEW, conn); return 0; @@ -342,7 +342,7 @@ static int mux_pt_wake(struct connection *conn) int ret = 0; TRACE_ENTER(PT_EV_CONN_WAKE, ctx->conn); - if (!se_fl_test(ctx->endp, CS_EP_ORPHAN)) { + if (!se_fl_test(ctx->endp, SE_FL_ORPHAN)) { ret = ctx->endp->cs->data_cb->wake ? ctx->endp->cs->data_cb->wake(ctx->endp->cs) : 0; if (ret < 0) { @@ -383,7 +383,7 @@ static int mux_pt_attach(struct connection *conn, struct cs_endpoint *endp, stru if (cs_attach_mux(endp->cs, ctx, conn) < 0) return -1; ctx->endp = endp; - se_fl_set(ctx->endp, CS_EP_RCV_MORE); + se_fl_set(ctx->endp, SE_FL_RCV_MORE); TRACE_LEAVE(PT_EV_STRM_NEW, conn, endp->cs); return 0; @@ -406,7 +406,7 @@ static void mux_pt_destroy_meth(void *ctx) struct mux_pt_ctx *pt = ctx; TRACE_POINT(PT_EV_CONN_END, pt->conn, pt->endp->cs); - if (se_fl_test(pt->endp, CS_EP_ORPHAN) || pt->conn->ctx != pt) { + if (se_fl_test(pt->endp, SE_FL_ORPHAN) || pt->conn->ctx != pt) { if (pt->conn->ctx != pt) { pt->endp = NULL; } @@ -444,7 +444,7 @@ static int mux_pt_used_streams(struct connection *conn) { struct mux_pt_ctx *ctx = conn->ctx; - return (!se_fl_test(ctx->endp, CS_EP_ORPHAN) ? 1 : 0); + return (!se_fl_test(ctx->endp, SE_FL_ORPHAN) ? 1 : 0); } /* returns the number of streams still available on a connection */ @@ -460,15 +460,15 @@ static void mux_pt_shutr(struct conn_stream *cs, enum co_shr_mode mode) TRACE_ENTER(PT_EV_STRM_SHUT, conn, cs); - if (se_fl_test(ctx->endp, CS_EP_SHR)) + if (se_fl_test(ctx->endp, SE_FL_SHR)) return; - se_fl_clr(ctx->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); + se_fl_clr(ctx->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); if (conn_xprt_ready(conn) && conn->xprt->shutr) conn->xprt->shutr(conn, conn->xprt_ctx, (mode == CO_SHR_DRAIN)); else if (mode == CO_SHR_DRAIN) conn_ctrl_drain(conn); - if (se_fl_test(ctx->endp, CS_EP_SHW)) + if (se_fl_test(ctx->endp, SE_FL_SHW)) conn_full_close(conn); TRACE_LEAVE(PT_EV_STRM_SHUT, conn, cs); @@ -481,12 +481,12 @@ static void mux_pt_shutw(struct conn_stream *cs, enum co_shw_mode mode) TRACE_ENTER(PT_EV_STRM_SHUT, conn, cs); - if (se_fl_test(ctx->endp, CS_EP_SHW)) + if (se_fl_test(ctx->endp, SE_FL_SHW)) return; if (conn_xprt_ready(conn) && conn->xprt->shutw) conn->xprt->shutw(conn, conn->xprt_ctx, (mode == CO_SHW_NORMAL)); - if (!se_fl_test(ctx->endp, CS_EP_SHR)) + if (!se_fl_test(ctx->endp, SE_FL_SHR)) conn_sock_shutw(conn, (mode == CO_SHW_NORMAL)); else conn_full_close(conn); @@ -516,19 +516,19 @@ static size_t mux_pt_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t TRACE_ENTER(PT_EV_RX_DATA, conn, cs, buf, (size_t[]){count}); if (!count) { - se_fl_set(ctx->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); + se_fl_set(ctx->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); goto end; } b_realign_if_empty(buf); ret = conn->xprt->rcv_buf(conn, conn->xprt_ctx, buf, count, flags); if (conn_xprt_read0_pending(conn)) { - se_fl_clr(ctx->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); - se_fl_set(ctx->endp, CS_EP_EOS); + se_fl_clr(ctx->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); + se_fl_set(ctx->endp, SE_FL_EOS); TRACE_DEVEL("read0 on connection", PT_EV_RX_DATA, conn, cs); } if (conn->flags & CO_FL_ERROR) { - se_fl_clr(ctx->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); - se_fl_set(ctx->endp, CS_EP_ERROR); + se_fl_clr(ctx->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); + se_fl_set(ctx->endp, SE_FL_ERROR); TRACE_DEVEL("error on connection", PT_EV_RX_DATA|PT_EV_CONN_ERR, conn, cs); } end: @@ -551,7 +551,7 @@ static size_t mux_pt_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t b_del(buf, ret); if (conn->flags & CO_FL_ERROR) { - se_fl_set(ctx->endp, CS_EP_ERROR); + se_fl_set(ctx->endp, SE_FL_ERROR); TRACE_DEVEL("error on connection", PT_EV_TX_DATA|PT_EV_CONN_ERR, conn, cs); } @@ -596,11 +596,11 @@ static int mux_pt_rcv_pipe(struct conn_stream *cs, struct pipe *pipe, unsigned i ret = conn->xprt->rcv_pipe(conn, conn->xprt_ctx, pipe, count); if (conn_xprt_read0_pending(conn)) { - se_fl_set(ctx->endp, CS_EP_EOS); + se_fl_set(ctx->endp, SE_FL_EOS); TRACE_DEVEL("read0 on connection", PT_EV_RX_DATA, conn, cs); } if (conn->flags & CO_FL_ERROR) { - se_fl_set(ctx->endp, CS_EP_ERROR); + se_fl_set(ctx->endp, SE_FL_ERROR); TRACE_DEVEL("error on connection", PT_EV_RX_DATA|PT_EV_CONN_ERR, conn, cs); } @@ -619,7 +619,7 @@ static int mux_pt_snd_pipe(struct conn_stream *cs, struct pipe *pipe) ret = conn->xprt->snd_pipe(conn, conn->xprt_ctx, pipe); if (conn->flags & CO_FL_ERROR) { - se_fl_set(ctx->endp, CS_EP_ERROR); + se_fl_set(ctx->endp, SE_FL_ERROR); TRACE_DEVEL("error on connection", PT_EV_TX_DATA|PT_EV_CONN_ERR, conn, cs); } diff --git a/src/mux_quic.c b/src/mux_quic.c index bcb2a81c0..878b44cc8 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -213,7 +213,7 @@ void qcs_free(struct qcs *qcs) qc_stream_desc_release(qcs->stream); - BUG_ON(qcs->endp && !se_fl_test(qcs->endp, CS_EP_ORPHAN)); + BUG_ON(qcs->endp && !se_fl_test(qcs->endp, SE_FL_ORPHAN)); cs_endpoint_free(qcs->endp); eb64_delete(&qcs->by_id); @@ -1499,15 +1499,15 @@ static size_t qc_rcv_buf(struct conn_stream *cs, struct buffer *buf, end: if (b_data(&qcs->rx.app_buf)) { - se_fl_set(qcs->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); + se_fl_set(qcs->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); } else { - se_fl_clr(qcs->endp, CS_EP_RCV_MORE | CS_EP_WANT_ROOM); - if (se_fl_test(qcs->endp, CS_EP_ERR_PENDING)) - se_fl_set(qcs->endp, CS_EP_ERROR); + se_fl_clr(qcs->endp, SE_FL_RCV_MORE | SE_FL_WANT_ROOM); + if (se_fl_test(qcs->endp, SE_FL_ERR_PENDING)) + se_fl_set(qcs->endp, SE_FL_ERROR); if (fin) - se_fl_set(qcs->endp, CS_EP_EOI); + se_fl_set(qcs->endp, SE_FL_EOI); if (b_size(&qcs->rx.app_buf)) { b_free(&qcs->rx.app_buf); @@ -1570,7 +1570,7 @@ static int qc_unsubscribe(struct conn_stream *cs, int event_type, struct wait_ev } /* Loop through all qcs from . If CO_FL_ERROR is set on the connection, - * report CS_EP_ERR_PENDING|CS_EP_ERROR on the attached conn-streams and wake + * report SE_FL_ERR_PENDING|SE_FL_ERROR on the attached conn-streams and wake * them. */ static int qc_wake_some_streams(struct qcc *qcc) @@ -1586,9 +1586,9 @@ static int qc_wake_some_streams(struct qcc *qcc) continue; if (qcc->conn->flags & CO_FL_ERROR) { - se_fl_set(qcs->endp, CS_EP_ERR_PENDING); - if (se_fl_test(qcs->endp, CS_EP_EOS)) - se_fl_set(qcs->endp, CS_EP_ERROR); + se_fl_set(qcs->endp, SE_FL_ERR_PENDING); + if (se_fl_test(qcs->endp, SE_FL_EOS)) + se_fl_set(qcs->endp, SE_FL_ERROR); if (qcs->subs) { qcs_notify_recv(qcs); diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 9f5bfa668..b7c526054 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -7889,7 +7889,7 @@ enum act_return ssl_action_wait_for_hs(struct act_rule *rule, struct proxy *px, if (conn && cs) { if (conn->flags & (CO_FL_EARLY_SSL_HS | CO_FL_SSL_WAIT_HS)) { - sc_ep_set(cs, CS_EP_WAIT_FOR_HS); + sc_ep_set(cs, SE_FL_WAIT_FOR_HS); s->req.flags |= CF_READ_NULL; return ACT_RET_YIELD; } diff --git a/src/stats.c b/src/stats.c index 012e84c6a..24207aec6 100644 --- a/src/stats.c +++ b/src/stats.c @@ -4349,7 +4349,7 @@ static void http_stats_io_handler(struct appctx *appctx) } res_htx->flags |= HTX_FL_EOM; res->flags |= CF_EOI; - se_fl_set(appctx->endp, CS_EP_EOI); + se_fl_set(appctx->endp, SE_FL_EOI); appctx->st0 = STAT_HTTP_END; } diff --git a/src/stream.c b/src/stream.c index 33d6da826..d5e2d8ad2 100644 --- a/src/stream.c +++ b/src/stream.c @@ -304,7 +304,7 @@ int stream_upgrade_from_cs(struct conn_stream *cs, struct buffer *input) /* Callback used to wake up a stream when an input buffer is available. The * stream 's conn-streams are checked for a failed buffer allocation - * as indicated by the presence of the CS_EP_RXBLK_ROOM flag and the lack of a + * as indicated by the presence of the SE_FL_RXBLK_ROOM flag and the lack of a * buffer, and and input buffer is assigned there (at most one). The function * returns 1 and wakes the stream up if a buffer was taken, otherwise zero. * It's designed to be called from __offer_buffer(). @@ -313,10 +313,10 @@ int stream_buf_available(void *arg) { struct stream *s = arg; - if (!s->req.buf.size && !s->req.pipe && sc_ep_test(s->csf, CS_EP_RXBLK_BUFF) && + if (!s->req.buf.size && !s->req.pipe && sc_ep_test(s->csf, SE_FL_RXBLK_BUFF) && b_alloc(&s->req.buf)) cs_rx_buff_rdy(s->csf); - else if (!s->res.buf.size && !s->res.pipe && sc_ep_test(s->csb, CS_EP_RXBLK_BUFF) && + else if (!s->res.buf.size && !s->res.pipe && sc_ep_test(s->csb, SE_FL_RXBLK_BUFF) && b_alloc(&s->res.buf)) cs_rx_buff_rdy(s->csb); else @@ -463,7 +463,7 @@ struct stream *stream_new(struct session *sess, struct conn_stream *cs, struct b if (likely(sess->fe->options2 & PR_O2_INDEPSTR)) s->csb->flags |= CS_FL_INDEP_STR; - if (sc_ep_test(cs, CS_EP_WEBSOCKET)) + if (sc_ep_test(cs, SE_FL_WEBSOCKET)) s->flags |= SF_WEBSOCKET; if (cs_conn(cs)) { const struct mux_ops *mux = cs_conn_mux(cs); @@ -886,7 +886,7 @@ static void back_establish(struct stream *s) s->flags &= ~SF_CONN_EXP; /* errors faced after sending data need to be reported */ - if (sc_ep_test(s->csb, CS_EP_ERROR) && req->flags & CF_WROTE_DATA) { + if (sc_ep_test(s->csb, SE_FL_ERROR) && req->flags & CF_WROTE_DATA) { /* Don't add CF_WRITE_ERROR if we're here because * early data were rejected by the server, or * http_wait_for_response() will never be called @@ -1716,7 +1716,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) (CF_SHUTR|CF_READ_ACTIVITY|CF_READ_TIMEOUT|CF_SHUTW| CF_WRITE_ACTIVITY|CF_WRITE_TIMEOUT|CF_ANA_TIMEOUT)) && !(s->flags & SF_CONN_EXP) && - !((sc_ep_get(csf) | csb->flags) & CS_EP_ERROR) && + !((sc_ep_get(csf) | csb->flags) & SE_FL_ERROR) && ((s->pending_events & TASK_WOKEN_ANY) == TASK_WOKEN_TIMER)) { csf->flags &= ~CS_FL_DONT_WAKE; csb->flags &= ~CS_FL_DONT_WAKE; @@ -1735,10 +1735,10 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) * must be be reviewed too. */ if (!stream_alloc_work_buffer(s)) { - sc_ep_set(s->csf, CS_EP_ERROR); + sc_ep_set(s->csf, SE_FL_ERROR); s->conn_err_type = STRM_ET_CONN_RES; - sc_ep_set(s->csb, CS_EP_ERROR); + sc_ep_set(s->csb, SE_FL_ERROR); s->conn_err_type = STRM_ET_CONN_RES; if (!(s->flags & SF_ERR_MASK)) @@ -1754,7 +1754,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) * connection setup code must be able to deal with any type of abort. */ srv = objt_server(s->target); - if (unlikely(sc_ep_test(csf, CS_EP_ERROR))) { + if (unlikely(sc_ep_test(csf, SE_FL_ERROR))) { if (cs_state_in(csf->state, CS_SB_EST|CS_SB_DIS)) { cs_shutr(csf); cs_shutw(csf); @@ -1774,7 +1774,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) } } - if (unlikely(sc_ep_test(csb, CS_EP_ERROR))) { + if (unlikely(sc_ep_test(csb, SE_FL_ERROR))) { if (cs_state_in(csb->state, CS_SB_EST|CS_SB_DIS)) { cs_shutr(csb); cs_shutw(csb); @@ -2328,8 +2328,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) /* Benchmarks have shown that it's optimal to do a full resync now */ if (csf->state == CS_ST_DIS || cs_state_in(csb->state, CS_SB_RDY|CS_SB_DIS) || - (sc_ep_test(csf, CS_EP_ERROR) && csf->state != CS_ST_CLO) || - (sc_ep_test(csb, CS_EP_ERROR) && csb->state != CS_ST_CLO)) + (sc_ep_test(csf, SE_FL_ERROR) && csf->state != CS_ST_CLO) || + (sc_ep_test(csb, SE_FL_ERROR) && csb->state != CS_ST_CLO)) goto resync_conn_stream; /* otherwise we want to check if we need to resync the req buffer or not */ @@ -2452,8 +2452,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) if (csf->state == CS_ST_DIS || cs_state_in(csb->state, CS_SB_RDY|CS_SB_DIS) || - (sc_ep_test(csf, CS_EP_ERROR) && csf->state != CS_ST_CLO) || - (sc_ep_test(csb, CS_EP_ERROR) && csb->state != CS_ST_CLO)) + (sc_ep_test(csf, SE_FL_ERROR) && csf->state != CS_ST_CLO) || + (sc_ep_test(csb, SE_FL_ERROR) && csb->state != CS_ST_CLO)) goto resync_conn_stream; if ((req->flags & ~rqf_last) & CF_MASK_ANALYSER) @@ -3307,9 +3307,8 @@ static int stats_dump_full_strm_to_buffer(struct conn_stream *cs, struct stream csf = strm->csf; chunk_appendf(&trash, " csf=%p flags=0x%08x state=%s endp=%s,%p,0x%08x sub=%d\n", csf, csf->flags, cs_state_str(csf->state), - (sc_ep_test(csf, CS_EP_T_MUX) ? "CONN" : (sc_ep_test(csf, CS_EP_T_APPLET) ? "APPCTX" : "NONE")), - csf->endp->target, sc_ep_get(csf), - csf->wait_event.events); + (sc_ep_test(csf, SE_FL_T_MUX) ? "CONN" : (sc_ep_test(csf, SE_FL_T_APPLET) ? "APPCTX" : "NONE")), + csf->endp->target, sc_ep_get(csf), csf->wait_event.events); if ((conn = cs_conn(csf)) != NULL) { chunk_appendf(&trash, @@ -3347,9 +3346,9 @@ static int stats_dump_full_strm_to_buffer(struct conn_stream *cs, struct stream csb = strm->csb; chunk_appendf(&trash, " csb=%p flags=0x%08x state=%s endp=%s,%p,0x%08x sub=%d\n", csb, csb->flags, cs_state_str(csb->state), - (sc_ep_test(csb, CS_EP_T_MUX) ? "CONN" : (sc_ep_test(csb, CS_EP_T_APPLET) ? "APPCTX" : "NONE")), - csb->endp->target, sc_ep_get(csb), - csb->wait_event.events); + (sc_ep_test(csb, SE_FL_T_MUX) ? "CONN" : (sc_ep_test(csb, SE_FL_T_APPLET) ? "APPCTX" : "NONE")), + csb->endp->target, sc_ep_get(csb), csb->wait_event.events); + if ((conn = cs_conn(csb)) != NULL) { chunk_appendf(&trash, " co1=%p ctrl=%s xprt=%s mux=%s data=%s target=%s:%p\n", diff --git a/src/tcpcheck.c b/src/tcpcheck.c index caceb6d97..3e570f375 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -1484,7 +1484,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_send(struct check *check, struct tcpcheck_r TRACE_DATA("send data", CHK_EV_TCPCHK_SND|CHK_EV_TX_DATA, check); if (conn->mux->snd_buf(cs, &check->bo, (IS_HTX_CONN(conn) ? (htxbuf(&check->bo))->data: b_data(&check->bo)), 0) <= 0) { - if ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, CS_EP_ERROR)) { + if ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR)) { ret = TCPCHK_EVAL_STOP; TRACE_DEVEL("connection error during send", CHK_EV_TCPCHK_SND|CHK_EV_TX_DATA|CHK_EV_TX_ERR, check); goto out; @@ -1548,7 +1548,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_r goto wait_more_data; } - if (sc_ep_test(cs, CS_EP_EOS)) + if (sc_ep_test(cs, SE_FL_EOS)) goto end_recv; if (check->state & CHK_ST_IN_ALLOC) { @@ -1565,15 +1565,15 @@ enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_r /* errors on the connection and the conn-stream were already checked */ /* prepare to detect if the mux needs more room */ - sc_ep_clr(cs, CS_EP_WANT_ROOM); + sc_ep_clr(cs, SE_FL_WANT_ROOM); - while (sc_ep_test(cs, CS_EP_RCV_MORE) || - (!(conn->flags & CO_FL_ERROR) && !sc_ep_test(cs, CS_EP_ERROR | CS_EP_EOS))) { + while (sc_ep_test(cs, SE_FL_RCV_MORE) || + (!(conn->flags & CO_FL_ERROR) && !sc_ep_test(cs, SE_FL_ERROR | SE_FL_EOS))) { max = (IS_HTX_CS(cs) ? htx_free_space(htxbuf(&check->bi)) : b_room(&check->bi)); read = conn->mux->rcv_buf(cs, &check->bi, max, 0); cur_read += read; if (!read || - sc_ep_test(cs, CS_EP_WANT_ROOM) || + sc_ep_test(cs, SE_FL_WANT_ROOM) || (--read_poll <= 0) || (read < max && read >= global.tune.recv_enough)) break; @@ -1581,7 +1581,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_r end_recv: is_empty = (IS_HTX_CS(cs) ? htx_is_empty(htxbuf(&check->bi)) : !b_data(&check->bi)); - if (is_empty && ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, CS_EP_ERROR))) { + if (is_empty && ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR))) { /* Report network errors only if we got no other data. Otherwise * we'll let the upper layers decide whether the response is OK * or not. It is very common that an RST sent by the server is @@ -1591,12 +1591,12 @@ enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_r goto stop; } if (!cur_read) { - if (sc_ep_test(cs, CS_EP_EOI)) { + if (sc_ep_test(cs, SE_FL_EOI)) { /* If EOI is set, it means there is a response or an error */ goto out; } - if (!sc_ep_test(cs, CS_EP_WANT_ROOM | CS_EP_ERROR | CS_EP_EOS)) { + if (!sc_ep_test(cs, SE_FL_WANT_ROOM | SE_FL_ERROR | SE_FL_EOS)) { conn->mux->subscribe(cs, SUB_RETRY_RECV, &cs->wait_event); TRACE_DEVEL("waiting for response", CHK_EV_RX_DATA, check); goto wait_more_data; @@ -2143,7 +2143,7 @@ int tcpcheck_main(struct check *check) */ /* 1- check for connection error, if any */ - if ((conn && conn->flags & CO_FL_ERROR) || sc_ep_test(cs, CS_EP_ERROR)) + if ((conn && conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR)) goto out_end_tcpcheck; /* 2- check if a rule must be resume. It happens if check->current_step @@ -2225,7 +2225,7 @@ int tcpcheck_main(struct check *check) goto out_end_tcpcheck; else if (eval_ret == TCPCHK_EVAL_WAIT) goto out; - last_read = ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, CS_EP_ERROR | CS_EP_EOS)); + last_read = ((conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR | SE_FL_EOS)); must_read = 0; } @@ -2306,7 +2306,7 @@ int tcpcheck_main(struct check *check) TRACE_PROTO("tcp-check passed", CHK_EV_TCPCHK_EVAL, check); out_end_tcpcheck: - if ((conn && conn->flags & CO_FL_ERROR) || sc_ep_test(cs, CS_EP_ERROR)) { + if ((conn && conn->flags & CO_FL_ERROR) || sc_ep_test(cs, SE_FL_ERROR)) { TRACE_ERROR("report connection error", CHK_EV_TCPCHK_EVAL|CHK_EV_TCPCHK_ERR, check); chk_report_conn_err(check, errno, 0); }