diff --git a/dev/flags/flags.c b/dev/flags/flags.c index a9f12af74..515666cb0 100644 --- a/dev/flags/flags.c +++ b/dev/flags/flags.c @@ -224,11 +224,11 @@ void show_cs_flags(unsigned int f) printf("0\n"); return; } - SHOW_FLAG(f, CS_FL_INDEP_STR); - SHOW_FLAG(f, CS_FL_DONT_WAKE); - SHOW_FLAG(f, CS_FL_NOLINGER); - SHOW_FLAG(f, CS_FL_NOHALF); - SHOW_FLAG(f, CS_FL_ISBACK); + SHOW_FLAG(f, SC_FL_INDEP_STR); + SHOW_FLAG(f, SC_FL_DONT_WAKE); + SHOW_FLAG(f, SC_FL_NOLINGER); + SHOW_FLAG(f, SC_FL_NOHALF); + SHOW_FLAG(f, SC_FL_ISBACK); if (f) { printf("EXTRA(0x%08x)", f); diff --git a/include/haproxy/conn_stream-t.h b/include/haproxy/conn_stream-t.h index c2f3f9c8d..d933cff69 100644 --- a/include/haproxy/conn_stream-t.h +++ b/include/haproxy/conn_stream-t.h @@ -85,17 +85,17 @@ enum se_flags { }; /* stconn flags */ -enum { - CS_FL_NONE = 0x00000000, /* Just for initialization purposes */ - CS_FL_ISBACK = 0x00000001, /* Set for CS on back-side */ +enum sc_flags { + SC_FL_NONE = 0x00000000, /* Just for initialization purposes */ + SC_FL_ISBACK = 0x00000001, /* Set for SC on back-side */ /* not used: 0x00000002 */ /* not used: 0x00000004 */ - CS_FL_NOLINGER = 0x00000008, /* may close without lingering. One-shot. */ - CS_FL_NOHALF = 0x00000010, /* no half close, close both sides at once */ - CS_FL_DONT_WAKE = 0x00000020, /* resync in progress, don't wake up */ - CS_FL_INDEP_STR = 0x00000040, /* independent streams = don't update rex on write */ + SC_FL_NOLINGER = 0x00000008, /* may close without lingering. One-shot. */ + SC_FL_NOHALF = 0x00000010, /* no half close, close both sides at once */ + SC_FL_DONT_WAKE = 0x00000020, /* resync in progress, don't wake up */ + SC_FL_INDEP_STR = 0x00000040, /* independent streams = don't update rex on write */ }; /* A conn stream must have its own errors independently of the buffer's, so that @@ -189,7 +189,7 @@ struct stconn { enum cs_state state; /* CS_ST* */ /* 2 bytes hole here */ - unsigned int flags; /* CS_FL_* */ + unsigned int flags; /* SC_FL_* */ unsigned int hcto; /* half-closed timeout (0 = unset) */ struct wait_event wait_event; /* We're in a wait list */ struct sedesc *sedesc; /* points to the stream endpoint descriptor */ diff --git a/include/haproxy/cs_utils.h b/include/haproxy/cs_utils.h index 052de02d1..ee20f307a 100644 --- a/include/haproxy/cs_utils.h +++ b/include/haproxy/cs_utils.h @@ -46,7 +46,7 @@ static inline struct channel *cs_ic(struct stconn *cs) { struct stream *strm = __cs_strm(cs); - return ((cs->flags & CS_FL_ISBACK) ? &(strm->res) : &(strm->req)); + return ((cs->flags & SC_FL_ISBACK) ? &(strm->res) : &(strm->req)); } /* returns the channel which feeds data to this stream connector (output channel) */ @@ -54,7 +54,7 @@ static inline struct channel *cs_oc(struct stconn *cs) { struct stream *strm = __cs_strm(cs); - return ((cs->flags & CS_FL_ISBACK) ? &(strm->req) : &(strm->res)); + return ((cs->flags & SC_FL_ISBACK) ? &(strm->req) : &(strm->res)); } /* returns the buffer which receives data from this stream connector (input channel's buffer) */ @@ -81,11 +81,11 @@ static inline struct stconn *cs_opposite(struct stconn *cs) { struct stream *strm = __cs_strm(cs); - return ((cs->flags & CS_FL_ISBACK) ? strm->scf : strm->scb); + return ((cs->flags & SC_FL_ISBACK) ? strm->scf : strm->scb); } -/* to be called only when in CS_ST_DIS with CS_FL_ERR */ +/* to be called only when in CS_ST_DIS with SC_FL_ERR */ static inline void cs_report_error(struct stconn *cs) { if (!__cs_strm(cs)->conn_err_type) @@ -173,7 +173,7 @@ static inline const struct sockaddr_storage *cs_src(struct stconn *cs) { if (cs->src) return cs->src; - if (!(cs->flags & CS_FL_ISBACK)) + if (!(cs->flags & SC_FL_ISBACK)) return sess_src(strm_sess(__cs_strm(cs))); else { struct connection *conn = cs_conn(cs); @@ -193,7 +193,7 @@ static inline const struct sockaddr_storage *cs_dst(struct stconn *cs) { if (cs->dst) return cs->dst; - if (!(cs->flags & CS_FL_ISBACK)) + if (!(cs->flags & SC_FL_ISBACK)) return sess_dst(strm_sess(__cs_strm(cs))); else { struct connection *conn = cs_conn(cs); @@ -217,7 +217,7 @@ static inline int cs_get_src(struct stconn *cs) if (cs->src) return 1; - if (!(cs->flags & CS_FL_ISBACK)) + if (!(cs->flags & SC_FL_ISBACK)) src = sess_src(strm_sess(__cs_strm(cs))); else { struct connection *conn = cs_conn(cs); @@ -247,7 +247,7 @@ static inline int cs_get_dst(struct stconn *cs) if (cs->dst) return 1; - if (!(cs->flags & CS_FL_ISBACK)) + if (!(cs->flags & SC_FL_ISBACK)) dst = sess_dst(strm_sess(__cs_strm(cs))); else { struct connection *conn = cs_conn(cs); diff --git a/src/applet.c b/src/applet.c index d39327e44..37e642fa0 100644 --- a/src/applet.c +++ b/src/applet.c @@ -114,7 +114,7 @@ void appctx_free_on_early_error(struct appctx *appctx) /* If a frontend appctx is attached to a stream connector, release the stream * instead of the appctx. */ - if (!se_fl_test(appctx->sedesc, SE_FL_ORPHAN) && !(appctx_cs(appctx)->flags & CS_FL_ISBACK)) { + if (!se_fl_test(appctx->sedesc, SE_FL_ORPHAN) && !(appctx_cs(appctx)->flags & SC_FL_ISBACK)) { stream_free(appctx_strm(appctx)); return; } diff --git a/src/backend.c b/src/backend.c index 02a4a8289..dc2083962 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1722,7 +1722,7 @@ static int connect_server(struct stream *s) /* disable lingering */ if (s->be->options & PR_O_TCP_NOLING) - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; if (s->flags & SF_SRV_REUSED) { _HA_ATOMIC_INC(&s->be->be_counters.reuse); @@ -2250,7 +2250,7 @@ void back_handle_st_con(struct stream *s) if ((rep->flags & CF_SHUTW) || ((req->flags & CF_SHUTW_NOW) && (channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) { - cs->flags |= CS_FL_NOLINGER; + cs->flags |= SC_FL_NOLINGER; cs_shutw(cs); s->conn_err_type |= STRM_ET_CONN_ABRT; if (s->srv_error) @@ -2479,7 +2479,7 @@ void back_handle_st_rdy(struct stream *s) ((req->flags & CF_SHUTW_NOW) && (channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) { /* give up */ - cs->flags |= CS_FL_NOLINGER; + cs->flags |= SC_FL_NOLINGER; cs_shutw(cs); s->conn_err_type |= STRM_ET_CONN_ABRT; if (s->srv_error) diff --git a/src/check.c b/src/check.c index 92d4bdcf8..5731439c9 100644 --- a/src/check.c +++ b/src/check.c @@ -1126,7 +1126,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state) check->current_step = NULL; - check->cs = cs_new_from_check(check, CS_FL_NONE); + check->cs = cs_new_from_check(check, SC_FL_NONE); if (!check->cs) { set_server_check_status(check, HCHK_STATUS_SOCKERR, NULL); goto end; diff --git a/src/cli.c b/src/cli.c index b789996b3..dc7d79c87 100644 --- a/src/cli.c +++ b/src/cli.c @@ -2704,7 +2704,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit) pcli_write_prompt(s); - s->scb->flags |= CS_FL_NOLINGER | CS_FL_NOHALF; + s->scb->flags |= SC_FL_NOLINGER | SC_FL_NOHALF; cs_shutr(s->scb); cs_shutw(s->scb); @@ -2788,7 +2788,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit) sockaddr_free(&s->scb->dst); cs_set_state(s->scb, CS_ST_INI); - s->scb->flags &= CS_FL_ISBACK | CS_FL_DONT_WAKE; /* we're in the context of process_stream */ + s->scb->flags &= SC_FL_ISBACK | SC_FL_DONT_WAKE; /* we're in the context of process_stream */ s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WROTE_DATA); s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA|CF_READ_NULL); s->flags &= ~(SF_DIRECT|SF_ASSIGNED|SF_BE_ASSIGNED|SF_FORCE_PRST|SF_IGNORE_PRST); diff --git a/src/conn_stream.c b/src/conn_stream.c index 8b22c4a46..655bcc9c2 100644 --- a/src/conn_stream.c +++ b/src/conn_stream.c @@ -126,7 +126,7 @@ static struct stconn *cs_new(struct sedesc *sedesc) goto alloc_error; cs->obj_type = OBJ_TYPE_CS; - cs->flags = CS_FL_NONE; + cs->flags = SC_FL_NONE; cs->state = CS_ST_INI; cs->hcto = TICK_ETERNITY; cs->app = NULL; @@ -391,7 +391,7 @@ static void cs_detach_endp(struct stconn **csp) /* FIXME: Rest CS for now but must be reviewed. CS flags are only * connection related for now but this will evolved */ - cs->flags &= CS_FL_ISBACK; + cs->flags &= SC_FL_ISBACK; if (cs_strm(cs)) cs->ops = &sc_app_embedded_ops; cs->data_cb = NULL; @@ -501,7 +501,7 @@ struct appctx *cs_applet_create(struct stconn *cs, struct applet *app) * This function performs a shutdown-read on a detached stream connector in a * connected or init state (it does nothing for other states). It either shuts * the read side or marks itself as closed. The buffer flags are updated to - * reflect the new state. If the stream connector has CS_FL_NOHALF, we also + * reflect the new state. If the stream connector has SC_FL_NOHALF, we also * forward the close to the write side. The owner task is woken up if it exists. */ static void sc_app_shutr(struct stconn *cs) @@ -521,13 +521,13 @@ static void sc_app_shutr(struct stconn *cs) cs->state = CS_ST_DIS; __cs_strm(cs)->conn_exp = TICK_ETERNITY; } - else if (cs->flags & CS_FL_NOHALF) { + else if (cs->flags & SC_FL_NOHALF) { /* we want to immediately forward this close to the write side */ return sc_app_shutw(cs); } /* note that if the task exists, it must unregister itself once it runs */ - if (!(cs->flags & CS_FL_DONT_WAKE)) + if (!(cs->flags & SC_FL_DONT_WAKE)) task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO); } @@ -561,10 +561,10 @@ static void sc_app_shutw(struct stconn *cs) /* we have to shut before closing, otherwise some short messages * may never leave the system, especially when there are remaining * unread data in the socket input buffer, or when nolinger is set. - * However, if CS_FL_NOLINGER is explicitly set, we know there is + * However, if SC_FL_NOLINGER is explicitly set, we know there is * no risk so we close both sides immediately. */ - if (!sc_ep_test(cs, SE_FL_ERROR) && !(cs->flags & CS_FL_NOLINGER) && + if (!sc_ep_test(cs, SE_FL_ERROR) && !(cs->flags & SC_FL_NOLINGER) && !(ic->flags & (CF_SHUTR|CF_DONT_READ))) return; @@ -577,7 +577,7 @@ static void sc_app_shutw(struct stconn *cs) cs->state = CS_ST_DIS; /* fall through */ default: - cs->flags &= ~CS_FL_NOLINGER; + cs->flags &= ~SC_FL_NOLINGER; cs_rx_shut_blk(cs); ic->flags |= CF_SHUTR; ic->rex = TICK_ETERNITY; @@ -585,7 +585,7 @@ static void sc_app_shutw(struct stconn *cs) } /* note that if the task exists, it must unregister itself once it runs */ - if (!(cs->flags & CS_FL_DONT_WAKE)) + if (!(cs->flags & SC_FL_DONT_WAKE)) task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO); } @@ -604,7 +604,7 @@ static void sc_app_chk_rcv(struct stconn *cs) } else { /* (re)start reading */ - if (!(cs->flags & CS_FL_DONT_WAKE)) + if (!(cs->flags & SC_FL_DONT_WAKE)) task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO); } } @@ -632,7 +632,7 @@ static void sc_app_chk_snd(struct stconn *cs) if (!tick_isset(oc->wex)) oc->wex = tick_add_ifset(now_ms, oc->wto); - if (!(cs->flags & CS_FL_DONT_WAKE)) + if (!(cs->flags & SC_FL_DONT_WAKE)) task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO); } @@ -641,7 +641,7 @@ static void sc_app_chk_snd(struct stconn *cs) * a connection in a connected or init state (it does nothing for other * states). It either shuts the read side or marks itself as closed. The buffer * flags are updated to reflect the new state. If the stream connector has - * CS_FL_NOHALF, we also forward the close to the write side. If a control + * SC_FL_NOHALF, we also forward the close to the write side. If a control * layer is defined, then it is supposed to be a socket layer and file * descriptors are then shutdown or closed accordingly. The function * automatically disables polling if needed. @@ -666,7 +666,7 @@ static void sc_app_shutr_conn(struct stconn *cs) cs->state = CS_ST_DIS; __cs_strm(cs)->conn_exp = TICK_ETERNITY; } - else if (cs->flags & CS_FL_NOHALF) { + else if (cs->flags & SC_FL_NOHALF) { /* we want to immediately forward this close to the write side */ return sc_app_shutw_conn(cs); } @@ -705,14 +705,14 @@ static void sc_app_shutw_conn(struct stconn *cs) /* we have to shut before closing, otherwise some short messages * may never leave the system, especially when there are remaining * unread data in the socket input buffer, or when nolinger is set. - * However, if CS_FL_NOLINGER is explicitly set, we know there is + * However, if SC_FL_NOLINGER is explicitly set, we know there is * no risk so we close both sides immediately. */ if (sc_ep_test(cs, SE_FL_ERROR)) { /* quick close, the socket is already shut anyway */ } - else if (cs->flags & CS_FL_NOLINGER) { + else if (cs->flags & SC_FL_NOLINGER) { /* unclean data-layer shutdown, typically an aborted request * or a forwarded shutdown from a client to a server due to * option abortonclose. No need for the TLS layer to try to @@ -746,7 +746,7 @@ static void sc_app_shutw_conn(struct stconn *cs) cs->state = CS_ST_DIS; /* fall through */ default: - cs->flags &= ~CS_FL_NOLINGER; + cs->flags &= ~SC_FL_NOLINGER; cs_rx_shut_blk(cs); ic->flags |= CF_SHUTR; ic->rex = TICK_ETERNITY; @@ -839,7 +839,7 @@ static void sc_app_chk_snd_conn(struct stconn *cs) !channel_is_empty(oc)) oc->wex = tick_add_ifset(now_ms, oc->wto); - if (tick_isset(ic->rex) && !(cs->flags & CS_FL_INDEP_STR)) { + if (tick_isset(ic->rex) && !(cs->flags & SC_FL_INDEP_STR)) { /* Note: to prevent the client from expiring read timeouts * during writes, we refresh it. We only do this if the * interface is not configured for "independent streams", @@ -860,7 +860,7 @@ static void sc_app_chk_snd_conn(struct stconn *cs) ((channel_is_empty(oc) && !oc->to_forward) || !cs_state_in(cs->state, CS_SB_EST))))) { out_wakeup: - if (!(cs->flags & CS_FL_DONT_WAKE)) + if (!(cs->flags & SC_FL_DONT_WAKE)) task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO); } } @@ -869,7 +869,7 @@ static void sc_app_chk_snd_conn(struct stconn *cs) * This function performs a shutdown-read on a stream connector attached to an * applet in a connected or init state (it does nothing for other states). It * either shuts the read side or marks itself as closed. The buffer flags are - * updated to reflect the new state. If the stream connector has CS_FL_NOHALF, + * updated to reflect the new state. If the stream connector has SC_FL_NOHALF, * we also forward the close to the write side. The owner task is woken up if * it exists. */ @@ -895,7 +895,7 @@ static void sc_app_shutr_applet(struct stconn *cs) cs->state = CS_ST_DIS; __cs_strm(cs)->conn_exp = TICK_ETERNITY; } - else if (cs->flags & CS_FL_NOHALF) { + else if (cs->flags & SC_FL_NOHALF) { /* we want to immediately forward this close to the write side */ return sc_app_shutw_applet(cs); } @@ -936,10 +936,10 @@ static void sc_app_shutw_applet(struct stconn *cs) /* we have to shut before closing, otherwise some short messages * may never leave the system, especially when there are remaining * unread data in the socket input buffer, or when nolinger is set. - * However, if CS_FL_NOLINGER is explicitly set, we know there is + * However, if SC_FL_NOLINGER is explicitly set, we know there is * no risk so we close both sides immediately. */ - if (!sc_ep_test(cs, SE_FL_ERROR) && !(cs->flags & CS_FL_NOLINGER) && + if (!sc_ep_test(cs, SE_FL_ERROR) && !(cs->flags & SC_FL_NOLINGER) && !(ic->flags & (CF_SHUTR|CF_DONT_READ))) return; @@ -953,7 +953,7 @@ static void sc_app_shutw_applet(struct stconn *cs) cs->state = CS_ST_DIS; /* fall through */ default: - cs->flags &= ~CS_FL_NOLINGER; + cs->flags &= ~SC_FL_NOLINGER; cs_rx_shut_blk(cs); ic->flags |= CF_SHUTR; ic->rex = TICK_ETERNITY; @@ -1087,7 +1087,7 @@ void cs_update_tx(struct stconn *cs) 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)) { + if (tick_isset(ic->rex) && !(cs->flags & SC_FL_INDEP_STR)) { /* Note: depending on the protocol, we don't know if we're waiting * for incoming data or not. So in order to prevent the socket from * expiring read timeouts during writes, we refresh the read timeout, @@ -1141,7 +1141,7 @@ static void cs_notify(struct stconn *cs) if (tick_isset(oc->wex)) oc->wex = tick_add_ifset(now_ms, oc->wto); - if (!(cs->flags & CS_FL_INDEP_STR)) + if (!(cs->flags & SC_FL_INDEP_STR)) if (tick_isset(ic->rex)) ic->rex = tick_add_ifset(now_ms, ic->rto); } @@ -1235,7 +1235,7 @@ static void cs_notify(struct stconn *cs) /* * This function propagates a null read received on a socket-based connection. - * It updates the stream connector. If the stream connector has CS_FL_NOHALF, + * It updates the stream connector. If the stream connector has SC_FL_NOHALF, * the close is also forwarded to the write side as an abort. */ static void cs_conn_read0(struct stconn *cs) @@ -1257,7 +1257,7 @@ static void cs_conn_read0(struct stconn *cs) if (oc->flags & CF_SHUTW) goto do_close; - if (cs->flags & CS_FL_NOHALF) { + if (cs->flags & SC_FL_NOHALF) { /* we want to immediately forward this close to the write side */ /* force flag on ssl to keep stream in cache */ cs_conn_shutw(cs, CO_SHW_SILENT); diff --git a/src/dns.c b/src/dns.c index 4fea59ccf..cf61d1715 100644 --- a/src/dns.c +++ b/src/dns.c @@ -829,7 +829,7 @@ static int dns_session_init(struct appctx *appctx) s = appctx_strm(appctx); s->scb->dst = addr; - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; s->target = &ds->dss->srv->obj_type; s->flags = SF_ASSIGNED; diff --git a/src/http_ana.c b/src/http_ana.c index 1a79648ef..66a36cb9d 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -1119,7 +1119,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) if (s->be->options & PR_O_ABRT_CLOSE) { channel_auto_read(req); if ((req->flags & (CF_SHUTR|CF_READ_NULL)) && !(txn->flags & TX_CON_WANT_TUN)) - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; channel_auto_close(req); } else if (s->txn->meth == HTTP_METH_POST) { @@ -1364,7 +1364,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit) stream_inc_http_fail_ctr(s); } - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; http_reply_and_close(s, txn->status, http_error_message(s)); if (!(s->flags & SF_ERR_MASK)) @@ -1394,7 +1394,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit) txn->status = 504; stream_inc_http_fail_ctr(s); - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; http_reply_and_close(s, txn->status, http_error_message(s)); if (!(s->flags & SF_ERR_MASK)) @@ -1451,7 +1451,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit) txn->status = 502; stream_inc_http_fail_ctr(s); - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; http_reply_and_close(s, txn->status, http_error_message(s)); if (!(s->flags & SF_ERR_MASK)) @@ -1746,7 +1746,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit) if (!(s->flags & SF_FINST_MASK)) s->flags |= SF_FINST_H; - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; DBG_TRACE_DEVEL("leaving on error", STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn); return 0; @@ -2056,7 +2056,7 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s return_prx_cond: s->logs.t_data = -1; /* was not a valid response */ - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; if (!(s->flags & SF_ERR_MASK)) s->flags |= SF_ERR_PRXCOND; @@ -4372,7 +4372,7 @@ static void http_end_request(struct stream *s) /* if the server closes the connection, we want to immediately react * and close the socket to save packets and syscalls. */ - s->scb->flags |= CS_FL_NOHALF; + s->scb->flags |= SC_FL_NOHALF; /* In any case we've finished parsing the request so we must * disable Nagle when sending data because 1) we're not going @@ -4447,7 +4447,7 @@ static void http_end_request(struct stream *s) http_msg_closed: /* if we don't know whether the server will close, we need to hard close */ if (txn->rsp.flags & HTTP_MSGF_XFER_LEN) - s->scb->flags |= CS_FL_NOLINGER; /* we want to close ASAP */ + s->scb->flags |= SC_FL_NOLINGER; /* we want to close ASAP */ /* see above in MSG_DONE why we only do this in these states */ if (!(s->be->options & PR_O_ABRT_CLOSE)) channel_dont_read(chn); diff --git a/src/http_client.c b/src/http_client.c index a725e97d9..14140442a 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -1015,7 +1015,7 @@ static int httpclient_applet_init(struct appctx *appctx) s->scb->dst = addr; } - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; s->flags |= SF_ASSIGNED; s->res.flags |= CF_READ_DONTWAIT; diff --git a/src/peers.c b/src/peers.c index c466b6a02..0a7a9268c 100644 --- a/src/peers.c +++ b/src/peers.c @@ -1090,7 +1090,7 @@ static int peer_session_init(struct appctx *appctx) /* initiate an outgoing connection */ s->scb->dst = addr; - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; s->flags = SF_ASSIGNED; s->target = peer_session_target(peer, s); diff --git a/src/proxy.c b/src/proxy.c index 77e6d4981..f73760f69 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -2358,9 +2358,9 @@ int stream_set_backend(struct stream *s, struct proxy *be) proxy_inc_be_ctr(be); /* assign new parameters to the stream from the new backend */ - s->scb->flags &= ~CS_FL_INDEP_STR; + s->scb->flags &= ~SC_FL_INDEP_STR; if (be->options2 & PR_O2_INDEPSTR) - s->scb->flags |= CS_FL_INDEP_STR; + s->scb->flags |= SC_FL_INDEP_STR; if (tick_isset(be->timeout.serverfin)) s->scb->hcto = be->timeout.serverfin; diff --git a/src/sink.c b/src/sink.c index a0ac7effb..804982a29 100644 --- a/src/sink.c +++ b/src/sink.c @@ -608,7 +608,7 @@ static int sink_forward_session_init(struct appctx *appctx) s = appctx_strm(appctx); s->scb->dst = addr; - s->scb->flags |= CS_FL_NOLINGER; + s->scb->flags |= SC_FL_NOLINGER; s->target = &sft->srv->obj_type; s->flags = SF_ASSIGNED; diff --git a/src/stream.c b/src/stream.c index 0302ee6f4..acfe49422 100644 --- a/src/stream.c +++ b/src/stream.c @@ -449,7 +449,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer if (cs_attach_strm(s->scf, s) < 0) goto out_fail_attach_scf; - s->scb = cs_new_from_strm(s, CS_FL_ISBACK); + s->scb = cs_new_from_strm(s, SC_FL_ISBACK); if (!s->scb) goto out_fail_alloc_scb; @@ -457,11 +457,11 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer s->scf->hcto = sess->fe->timeout.clientfin; if (likely(sess->fe->options2 & PR_O2_INDEPSTR)) - s->scf->flags |= CS_FL_INDEP_STR; + s->scf->flags |= SC_FL_INDEP_STR; s->scb->hcto = TICK_ETERNITY; if (likely(sess->fe->options2 & PR_O2_INDEPSTR)) - s->scb->flags |= CS_FL_INDEP_STR; + s->scb->flags |= SC_FL_INDEP_STR; if (sc_ep_test(cs, SE_FL_WEBSOCKET)) s->flags |= SF_WEBSOCKET; @@ -1660,8 +1660,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) rpf_last = res->flags & ~CF_MASK_ANALYSER; /* we don't want the stream connector functions to recursively wake us up */ - scf->flags |= CS_FL_DONT_WAKE; - scb->flags |= CS_FL_DONT_WAKE; + scf->flags |= SC_FL_DONT_WAKE; + scb->flags |= SC_FL_DONT_WAKE; /* update pending events */ s->pending_events |= (state & TASK_WOKEN_ANY); @@ -1681,26 +1681,26 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) channel_check_timeouts(req); if (unlikely((req->flags & (CF_SHUTW|CF_WRITE_TIMEOUT)) == CF_WRITE_TIMEOUT)) { - scb->flags |= CS_FL_NOLINGER; + scb->flags |= SC_FL_NOLINGER; cs_shutw(scb); } if (unlikely((req->flags & (CF_SHUTR|CF_READ_TIMEOUT)) == CF_READ_TIMEOUT)) { - if (scf->flags & CS_FL_NOHALF) - scf->flags |= CS_FL_NOLINGER; + if (scf->flags & SC_FL_NOHALF) + scf->flags |= SC_FL_NOLINGER; cs_shutr(scf); } channel_check_timeouts(res); if (unlikely((res->flags & (CF_SHUTW|CF_WRITE_TIMEOUT)) == CF_WRITE_TIMEOUT)) { - scf->flags |= CS_FL_NOLINGER; + scf->flags |= SC_FL_NOLINGER; cs_shutw(scf); } if (unlikely((res->flags & (CF_SHUTR|CF_READ_TIMEOUT)) == CF_READ_TIMEOUT)) { - if (scb->flags & CS_FL_NOHALF) - scb->flags |= CS_FL_NOLINGER; + if (scb->flags & SC_FL_NOHALF) + scb->flags |= SC_FL_NOLINGER; cs_shutr(scb); } @@ -1718,8 +1718,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) !(s->flags & SF_CONN_EXP) && !((sc_ep_get(scf) | scb->flags) & SE_FL_ERROR) && ((s->pending_events & TASK_WOKEN_ANY) == TASK_WOKEN_TIMER)) { - scf->flags &= ~CS_FL_DONT_WAKE; - scb->flags &= ~CS_FL_DONT_WAKE; + scf->flags &= ~SC_FL_DONT_WAKE; + scb->flags &= ~SC_FL_DONT_WAKE; goto update_exp_and_leave; } } @@ -2309,7 +2309,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) if (unlikely((req->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW && channel_is_empty(req))) { if (req->flags & CF_READ_ERROR) - scb->flags |= CS_FL_NOLINGER; + scb->flags |= SC_FL_NOLINGER; cs_shutw(scb); } @@ -2320,8 +2320,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) /* shutdown(read) pending */ if (unlikely((req->flags & (CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTR_NOW)) { - if (scf->flags & CS_FL_NOHALF) - scf->flags |= CS_FL_NOLINGER; + if (scf->flags & SC_FL_NOHALF) + scf->flags |= SC_FL_NOLINGER; cs_shutr(scf); } @@ -2445,8 +2445,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) /* shutdown(read) pending */ if (unlikely((res->flags & (CF_SHUTR|CF_SHUTR_NOW)) == CF_SHUTR_NOW)) { - if (scb->flags & CS_FL_NOHALF) - scb->flags |= CS_FL_NOLINGER; + if (scb->flags & SC_FL_NOHALF) + scb->flags |= SC_FL_NOLINGER; cs_shutr(scb); } @@ -2466,8 +2466,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) goto resync_request; /* we're interested in getting wakeups again */ - scf->flags &= ~CS_FL_DONT_WAKE; - scb->flags &= ~CS_FL_DONT_WAKE; + scf->flags &= ~SC_FL_DONT_WAKE; + scb->flags &= ~SC_FL_DONT_WAKE; if (likely((scf->state != CS_ST_CLO) || !cs_state_in(scb->state, CS_SB_INI|CS_SB_CLO) || (req->analysers & AN_REQ_FLT_END) || (res->analysers & AN_RES_FLT_END))) { @@ -2494,7 +2494,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) s->pending_events = 0; update_exp_and_leave: - /* Note: please ensure that if you branch here you disable CS_FL_DONT_WAKE */ + /* Note: please ensure that if you branch here you disable SC_FL_DONT_WAKE */ t->expire = tick_first((tick_is_expired(t->expire, now_ms) ? 0 : t->expire), tick_first(tick_first(req->rex, req->wex), tick_first(res->rex, res->wex))); diff --git a/src/tcp_act.c b/src/tcp_act.c index 047cded57..c4b747e49 100644 --- a/src/tcp_act.c +++ b/src/tcp_act.c @@ -287,7 +287,7 @@ static enum act_return tcp_exec_action_silent_drop(struct act_rule *rule, struct * is present, returning with ERR will cause lingering to be disabled. */ if (strm) - strm->scf->flags |= CS_FL_NOLINGER; + strm->scf->flags |= SC_FL_NOLINGER; if (conn->flags & CO_FL_FDLESS) goto out; diff --git a/src/tcp_rules.c b/src/tcp_rules.c index 77bd663f6..c8a3cb9c3 100644 --- a/src/tcp_rules.c +++ b/src/tcp_rules.c @@ -391,7 +391,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit) goto deny; } else if (rule->action == ACT_TCP_CLOSE) { - chn_prod(rep)->flags |= CS_FL_NOLINGER | CS_FL_NOHALF; + chn_prod(rep)->flags |= SC_FL_NOLINGER | SC_FL_NOHALF; cs_must_kill_conn(chn_prod(rep)); cs_shutr(chn_prod(rep)); cs_shutw(chn_prod(rep));