mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
CLEANUP: stconn: rename cs_{check,strm,strm_task} to sc_strm_*
These functions return the app-layer associated with an stconn, which is a check, a stream or a stream's task. They're used a lot to access channels, flags and for waking up tasks. Let's just name them appropriately for the stream connector.
This commit is contained in:
parent
40a9c32e3a
commit
ea27f48c5a
@ -1504,7 +1504,7 @@ static int promex_appctx_init(struct appctx *appctx)
|
||||
static void promex_appctx_handle_io(struct appctx *appctx)
|
||||
{
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct channel *req = sc_oc(cs);
|
||||
struct channel *res = sc_ic(cs);
|
||||
struct htx *req_htx, *res_htx;
|
||||
|
@ -121,11 +121,11 @@ static inline struct stconn *appctx_cs(const struct appctx *appctx)
|
||||
}
|
||||
|
||||
/* returns the stream the appctx is attached to. Note that a stream *must*
|
||||
* be attached, as we use an unchecked dereference via __cs_strm().
|
||||
* be attached, as we use an unchecked dereference via __sc_strm().
|
||||
*/
|
||||
static inline struct stream *appctx_strm(const struct appctx *appctx)
|
||||
{
|
||||
return __cs_strm(appctx->sedesc->sc);
|
||||
return __sc_strm(appctx->sedesc->sc);
|
||||
}
|
||||
|
||||
/* writes chunk <chunk> into the input channel of the stream attached to this
|
||||
|
@ -186,30 +186,30 @@ static inline struct appctx *cs_appctx(const struct stconn *cs)
|
||||
}
|
||||
|
||||
/* Returns the stream from a cs if the application is a stream. Otherwise
|
||||
* NULL is returned. __cs_strm() returns the stream without any control
|
||||
* while cs_strm() check the application type.
|
||||
* NULL is returned. __sc_strm() returns the stream without any control
|
||||
* while sc_strm() check the application type.
|
||||
*/
|
||||
static inline struct stream *__cs_strm(const struct stconn *cs)
|
||||
static inline struct stream *__sc_strm(const struct stconn *cs)
|
||||
{
|
||||
return __objt_stream(cs->app);
|
||||
}
|
||||
|
||||
static inline struct stream *cs_strm(const struct stconn *cs)
|
||||
static inline struct stream *sc_strm(const struct stconn *cs)
|
||||
{
|
||||
if (obj_type(cs->app) == OBJ_TYPE_STREAM)
|
||||
return __cs_strm(cs);
|
||||
return __sc_strm(cs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Returns the healthcheck from a cs if the application is a
|
||||
* healthcheck. Otherwise NULL is returned. __cs_check() returns the healthcheck
|
||||
* without any control while cs_check() check the application type.
|
||||
* healthcheck. Otherwise NULL is returned. __sc_check() returns the healthcheck
|
||||
* without any control while sc_check() check the application type.
|
||||
*/
|
||||
static inline struct check *__cs_check(const struct stconn *cs)
|
||||
static inline struct check *__sc_check(const struct stconn *cs)
|
||||
{
|
||||
return __objt_check(cs->app);
|
||||
}
|
||||
static inline struct check *cs_check(const struct stconn *cs)
|
||||
static inline struct check *sc_check(const struct stconn *cs)
|
||||
{
|
||||
if (obj_type(cs->app) == OBJ_TYPE_CHECK)
|
||||
return __objt_check(cs->app);
|
||||
|
@ -44,7 +44,7 @@ void cs_conn_sync_send(struct stconn *cs);
|
||||
/* returns the channel which receives data from this stream connector (input channel) */
|
||||
static inline struct channel *sc_ic(struct stconn *cs)
|
||||
{
|
||||
struct stream *strm = __cs_strm(cs);
|
||||
struct stream *strm = __sc_strm(cs);
|
||||
|
||||
return ((cs->flags & SC_FL_ISBACK) ? &(strm->res) : &(strm->req));
|
||||
}
|
||||
@ -52,7 +52,7 @@ static inline struct channel *sc_ic(struct stconn *cs)
|
||||
/* returns the channel which feeds data to this stream connector (output channel) */
|
||||
static inline struct channel *sc_oc(struct stconn *cs)
|
||||
{
|
||||
struct stream *strm = __cs_strm(cs);
|
||||
struct stream *strm = __sc_strm(cs);
|
||||
|
||||
return ((cs->flags & SC_FL_ISBACK) ? &(strm->req) : &(strm->res));
|
||||
}
|
||||
@ -69,9 +69,9 @@ static inline struct buffer *sc_ob(struct stconn *cs)
|
||||
return &sc_oc(cs)->buf;
|
||||
}
|
||||
/* returns the stream's task associated to this stream connector */
|
||||
static inline struct task *cs_strm_task(struct stconn *cs)
|
||||
static inline struct task *sc_strm_task(struct stconn *cs)
|
||||
{
|
||||
struct stream *strm = __cs_strm(cs);
|
||||
struct stream *strm = __sc_strm(cs);
|
||||
|
||||
return strm->task;
|
||||
}
|
||||
@ -79,7 +79,7 @@ static inline struct task *cs_strm_task(struct stconn *cs)
|
||||
/* returns the stream connector on the other side. Used during forwarding. */
|
||||
static inline struct stconn *cs_opposite(struct stconn *cs)
|
||||
{
|
||||
struct stream *strm = __cs_strm(cs);
|
||||
struct stream *strm = __sc_strm(cs);
|
||||
|
||||
return ((cs->flags & SC_FL_ISBACK) ? strm->scf : strm->scb);
|
||||
}
|
||||
@ -88,8 +88,8 @@ static inline struct stconn *cs_opposite(struct stconn *cs)
|
||||
/* to be called only when in SC_ST_DIS with SC_FL_ERR */
|
||||
static inline void cs_report_error(struct stconn *cs)
|
||||
{
|
||||
if (!__cs_strm(cs)->conn_err_type)
|
||||
__cs_strm(cs)->conn_err_type = STRM_ET_DATA_ERR;
|
||||
if (!__sc_strm(cs)->conn_err_type)
|
||||
__sc_strm(cs)->conn_err_type = STRM_ET_DATA_ERR;
|
||||
|
||||
sc_oc(cs)->flags |= CF_WRITE_ERROR;
|
||||
sc_ic(cs)->flags |= CF_READ_ERROR;
|
||||
@ -100,7 +100,7 @@ static inline void cs_report_error(struct stconn *cs)
|
||||
*/
|
||||
static inline void cs_set_state(struct stconn *cs, int state)
|
||||
{
|
||||
cs->state = __cs_strm(cs)->prev_conn_state = state;
|
||||
cs->state = __sc_strm(cs)->prev_conn_state = state;
|
||||
}
|
||||
|
||||
/* returns a bit for a stream connector state, to match against SC_SB_* */
|
||||
@ -174,7 +174,7 @@ static inline const struct sockaddr_storage *cs_src(struct stconn *cs)
|
||||
if (cs->src)
|
||||
return cs->src;
|
||||
if (!(cs->flags & SC_FL_ISBACK))
|
||||
return sess_src(strm_sess(__cs_strm(cs)));
|
||||
return sess_src(strm_sess(__sc_strm(cs)));
|
||||
else {
|
||||
struct connection *conn = cs_conn(cs);
|
||||
|
||||
@ -194,7 +194,7 @@ static inline const struct sockaddr_storage *cs_dst(struct stconn *cs)
|
||||
if (cs->dst)
|
||||
return cs->dst;
|
||||
if (!(cs->flags & SC_FL_ISBACK))
|
||||
return sess_dst(strm_sess(__cs_strm(cs)));
|
||||
return sess_dst(strm_sess(__sc_strm(cs)));
|
||||
else {
|
||||
struct connection *conn = cs_conn(cs);
|
||||
|
||||
@ -218,7 +218,7 @@ static inline int cs_get_src(struct stconn *cs)
|
||||
return 1;
|
||||
|
||||
if (!(cs->flags & SC_FL_ISBACK))
|
||||
src = sess_src(strm_sess(__cs_strm(cs)));
|
||||
src = sess_src(strm_sess(__sc_strm(cs)));
|
||||
else {
|
||||
struct connection *conn = cs_conn(cs);
|
||||
|
||||
@ -248,7 +248,7 @@ static inline int cs_get_dst(struct stconn *cs)
|
||||
return 1;
|
||||
|
||||
if (!(cs->flags & SC_FL_ISBACK))
|
||||
dst = sess_dst(strm_sess(__cs_strm(cs)));
|
||||
dst = sess_dst(strm_sess(__sc_strm(cs)));
|
||||
else {
|
||||
struct connection *conn = cs_conn(cs);
|
||||
|
||||
|
@ -1505,7 +1505,7 @@ static void http_cache_io_handler(struct appctx *appctx)
|
||||
|
||||
/* Skip response body for HEAD requests or in case of "304 Not
|
||||
* Modified" response. */
|
||||
if (__cs_strm(cs)->txn->meth == HTTP_METH_HEAD || ctx->send_notmodified)
|
||||
if (__sc_strm(cs)->txn->meth == HTTP_METH_HEAD || ctx->send_notmodified)
|
||||
appctx->st0 = HTX_CACHE_EOM;
|
||||
else
|
||||
appctx->st0 = HTX_CACHE_DATA;
|
||||
|
@ -1012,7 +1012,7 @@ int httpchk_build_status_header(struct server *s, struct buffer *buf)
|
||||
int wake_srv_chk(struct stconn *cs)
|
||||
{
|
||||
struct connection *conn;
|
||||
struct check *check = __cs_check(cs);
|
||||
struct check *check = __sc_check(cs);
|
||||
struct email_alertq *q = container_of(check, typeof(*q), check);
|
||||
int ret = 0;
|
||||
|
||||
|
@ -900,7 +900,7 @@ static void cli_io_handler(struct appctx *appctx)
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct channel *req = sc_oc(cs);
|
||||
struct channel *res = sc_ic(cs);
|
||||
struct bind_conf *bind_conf = strm_li(__cs_strm(cs))->bind_conf;
|
||||
struct bind_conf *bind_conf = strm_li(__sc_strm(cs))->bind_conf;
|
||||
int reql;
|
||||
int len;
|
||||
|
||||
@ -1970,7 +1970,7 @@ static int _getsocks(char **args, char *payload, struct appctx *appctx, void *pr
|
||||
unsigned char *tmpbuf = NULL;
|
||||
struct cmsghdr *cmsg;
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct connection *remote = cs_conn(cs_opposite(cs));
|
||||
struct msghdr msghdr;
|
||||
struct iovec iov;
|
||||
|
@ -258,7 +258,7 @@ int cs_attach_mux(struct stconn *cs, void *endp, void *ctx)
|
||||
se_fl_clr(sedesc, SE_FL_DETACHED);
|
||||
if (!conn->ctx)
|
||||
conn->ctx = cs;
|
||||
if (cs_strm(cs)) {
|
||||
if (sc_strm(cs)) {
|
||||
if (!cs->wait_event.tasklet) {
|
||||
cs->wait_event.tasklet = tasklet_new();
|
||||
if (!cs->wait_event.tasklet)
|
||||
@ -270,7 +270,7 @@ int cs_attach_mux(struct stconn *cs, void *endp, void *ctx)
|
||||
|
||||
cs->app_ops = &sc_app_conn_ops;
|
||||
}
|
||||
else if (cs_check(cs)) {
|
||||
else if (sc_check(cs)) {
|
||||
if (!cs->wait_event.tasklet) {
|
||||
cs->wait_event.tasklet = tasklet_new();
|
||||
if (!cs->wait_event.tasklet)
|
||||
@ -295,7 +295,7 @@ static void cs_attach_applet(struct stconn *cs, void *endp)
|
||||
cs->sedesc->se = endp;
|
||||
sc_ep_set(cs, SE_FL_T_APPLET);
|
||||
sc_ep_clr(cs, SE_FL_DETACHED);
|
||||
if (cs_strm(cs))
|
||||
if (sc_strm(cs))
|
||||
cs->app_ops = &sc_app_applet_ops;
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ static void cs_detach_endp(struct stconn **csp)
|
||||
* connection related for now but this will evolved
|
||||
*/
|
||||
cs->flags &= SC_FL_ISBACK;
|
||||
if (cs_strm(cs))
|
||||
if (sc_strm(cs))
|
||||
cs->app_ops = &sc_app_embedded_ops;
|
||||
else
|
||||
cs->app_ops = NULL;
|
||||
@ -482,13 +482,13 @@ struct appctx *cs_applet_create(struct stconn *cs, struct applet *app)
|
||||
{
|
||||
struct appctx *appctx;
|
||||
|
||||
DPRINTF(stderr, "registering handler %p for cs %p (was %p)\n", app, cs, cs_strm_task(cs));
|
||||
DPRINTF(stderr, "registering handler %p for cs %p (was %p)\n", app, cs, sc_strm_task(cs));
|
||||
|
||||
appctx = appctx_new_here(app, cs->sedesc);
|
||||
if (!appctx)
|
||||
return NULL;
|
||||
cs_attach_applet(cs, appctx);
|
||||
appctx->t->nice = __cs_strm(cs)->task->nice;
|
||||
appctx->t->nice = __sc_strm(cs)->task->nice;
|
||||
cs_cant_get(cs);
|
||||
appctx_wakeup(appctx);
|
||||
|
||||
@ -518,7 +518,7 @@ static void sc_app_shutr(struct stconn *cs)
|
||||
|
||||
if (sc_oc(cs)->flags & CF_SHUTW) {
|
||||
cs->state = SC_ST_DIS;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
__sc_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
}
|
||||
else if (cs->flags & SC_FL_NOHALF) {
|
||||
/* we want to immediately forward this close to the write side */
|
||||
@ -527,7 +527,7 @@ static void sc_app_shutr(struct stconn *cs)
|
||||
|
||||
/* note that if the task exists, it must unregister itself once it runs */
|
||||
if (!(cs->flags & SC_FL_DONT_WAKE))
|
||||
task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO);
|
||||
task_wakeup(sc_strm_task(cs), TASK_WOKEN_IO);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -580,12 +580,12 @@ static void sc_app_shutw(struct stconn *cs)
|
||||
cs_rx_shut_blk(cs);
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
__sc_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
}
|
||||
|
||||
/* note that if the task exists, it must unregister itself once it runs */
|
||||
if (!(cs->flags & SC_FL_DONT_WAKE))
|
||||
task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO);
|
||||
task_wakeup(sc_strm_task(cs), TASK_WOKEN_IO);
|
||||
}
|
||||
|
||||
/* default chk_rcv function for scheduled tasks */
|
||||
@ -604,7 +604,7 @@ static void sc_app_chk_rcv(struct stconn *cs)
|
||||
else {
|
||||
/* (re)start reading */
|
||||
if (!(cs->flags & SC_FL_DONT_WAKE))
|
||||
task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO);
|
||||
task_wakeup(sc_strm_task(cs), TASK_WOKEN_IO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -632,7 +632,7 @@ static void sc_app_chk_snd(struct stconn *cs)
|
||||
oc->wex = tick_add_ifset(now_ms, oc->wto);
|
||||
|
||||
if (!(cs->flags & SC_FL_DONT_WAKE))
|
||||
task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO);
|
||||
task_wakeup(sc_strm_task(cs), TASK_WOKEN_IO);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -663,7 +663,7 @@ static void sc_app_shutr_conn(struct stconn *cs)
|
||||
if (sc_oc(cs)->flags & CF_SHUTW) {
|
||||
cs_conn_shut(cs);
|
||||
cs->state = SC_ST_DIS;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
__sc_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
}
|
||||
else if (cs->flags & SC_FL_NOHALF) {
|
||||
/* we want to immediately forward this close to the write side */
|
||||
@ -749,7 +749,7 @@ static void sc_app_shutw_conn(struct stconn *cs)
|
||||
cs_rx_shut_blk(cs);
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
__sc_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
}
|
||||
}
|
||||
|
||||
@ -860,7 +860,7 @@ static void sc_app_chk_snd_conn(struct stconn *cs)
|
||||
!cs_state_in(cs->state, SC_SB_EST))))) {
|
||||
out_wakeup:
|
||||
if (!(cs->flags & SC_FL_DONT_WAKE))
|
||||
task_wakeup(cs_strm_task(cs), TASK_WOKEN_IO);
|
||||
task_wakeup(sc_strm_task(cs), TASK_WOKEN_IO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -892,7 +892,7 @@ static void sc_app_shutr_applet(struct stconn *cs)
|
||||
if (sc_oc(cs)->flags & CF_SHUTW) {
|
||||
appctx_shut(__cs_appctx(cs));
|
||||
cs->state = SC_ST_DIS;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
__sc_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
}
|
||||
else if (cs->flags & SC_FL_NOHALF) {
|
||||
/* we want to immediately forward this close to the write side */
|
||||
@ -956,7 +956,7 @@ static void sc_app_shutw_applet(struct stconn *cs)
|
||||
cs_rx_shut_blk(cs);
|
||||
ic->flags |= CF_SHUTR;
|
||||
ic->rex = TICK_ETERNITY;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
__sc_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1113,7 +1113,7 @@ static void cs_notify(struct stconn *cs)
|
||||
struct channel *ic = sc_ic(cs);
|
||||
struct channel *oc = sc_oc(cs);
|
||||
struct stconn *cso = cs_opposite(cs);
|
||||
struct task *task = cs_strm_task(cs);
|
||||
struct task *task = sc_strm_task(cs);
|
||||
|
||||
/* process consumer side */
|
||||
if (channel_is_empty(oc)) {
|
||||
@ -1224,7 +1224,7 @@ static void cs_notify(struct stconn *cs)
|
||||
|
||||
task->expire = tick_first(task->expire, ic->analyse_exp);
|
||||
task->expire = tick_first(task->expire, oc->analyse_exp);
|
||||
task->expire = tick_first(task->expire, __cs_strm(cs)->conn_exp);
|
||||
task->expire = tick_first(task->expire, __sc_strm(cs)->conn_exp);
|
||||
|
||||
task_queue(task);
|
||||
}
|
||||
@ -1277,7 +1277,7 @@ static void cs_conn_read0(struct stconn *cs)
|
||||
cs_done_get(cs);
|
||||
|
||||
cs->state = SC_ST_DIS;
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
__sc_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1410,7 +1410,7 @@ static int cs_conn_recv(struct stconn *cs)
|
||||
}
|
||||
|
||||
/* now we'll need a input buffer for the stream */
|
||||
if (!cs_alloc_ibuf(cs, &(__cs_strm(cs)->buffer_wait)))
|
||||
if (!cs_alloc_ibuf(cs, &(__sc_strm(cs)->buffer_wait)))
|
||||
goto end_recv;
|
||||
|
||||
/* For an HTX stream, if the buffer is stuck (no output data with some
|
||||
@ -1422,7 +1422,7 @@ static int cs_conn_recv(struct stconn *cs)
|
||||
* NOTE: A possible optim may be to let the mux decides if defrag is
|
||||
* required or not, depending on amount of data to be xferred.
|
||||
*/
|
||||
if (IS_HTX_STRM(__cs_strm(cs)) && !co_data(ic)) {
|
||||
if (IS_HTX_STRM(__sc_strm(cs)) && !co_data(ic)) {
|
||||
struct htx *htx = htxbuf(&ic->buf);
|
||||
|
||||
if (htx_is_not_empty(htx) && ((htx->flags & HTX_FL_FRAGMENTED) || htx_space_wraps(htx)))
|
||||
@ -1430,7 +1430,7 @@ static int cs_conn_recv(struct stconn *cs)
|
||||
}
|
||||
|
||||
/* Instruct the mux it must subscribed for read events */
|
||||
flags |= ((!conn_is_back(conn) && (__cs_strm(cs)->be->options & PR_O_ABRT_CLOSE)) ? CO_RFL_KEEP_RECV : 0);
|
||||
flags |= ((!conn_is_back(conn) && (__sc_strm(cs)->be->options & PR_O_ABRT_CLOSE)) ? CO_RFL_KEEP_RECV : 0);
|
||||
|
||||
/* Important note : if we're called with POLL_IN|POLL_HUP, it means the read polling
|
||||
* was enabled, which implies that the recv buffer was not full. So we have a guarantee
|
||||
@ -1643,7 +1643,7 @@ int cs_conn_sync_recv(struct stconn *cs)
|
||||
static int cs_conn_send(struct stconn *cs)
|
||||
{
|
||||
struct connection *conn = __cs_conn(cs);
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct channel *oc = sc_oc(cs);
|
||||
int ret;
|
||||
int did_send = 0;
|
||||
@ -1850,12 +1850,12 @@ static int cs_conn_process(struct stconn *cs)
|
||||
if (!(conn->flags & (CO_FL_WAIT_XPRT | CO_FL_EARLY_SSL_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);
|
||||
task_wakeup(sc_strm_task(cs), TASK_WOKEN_MSG);
|
||||
}
|
||||
|
||||
if (!cs_state_in(cs->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO) &&
|
||||
(conn->flags & CO_FL_WAIT_XPRT) == 0) {
|
||||
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
__sc_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
oc->flags |= CF_WRITE_NULL;
|
||||
if (cs->state == SC_ST_CON)
|
||||
cs->state = SC_ST_RDY;
|
||||
@ -1891,7 +1891,7 @@ static int cs_conn_process(struct stconn *cs)
|
||||
* stream connector status.
|
||||
*/
|
||||
cs_notify(cs);
|
||||
stream_release_buffers(__cs_strm(cs));
|
||||
stream_release_buffers(__sc_strm(cs));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1915,7 +1915,7 @@ struct task *cs_conn_io_cb(struct task *t, void *ctx, unsigned int state)
|
||||
if (ret != 0)
|
||||
cs_conn_process(cs);
|
||||
|
||||
stream_release_buffers(__cs_strm(cs));
|
||||
stream_release_buffers(__sc_strm(cs));
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -1944,7 +1944,7 @@ static int cs_applet_process(struct stconn *cs)
|
||||
|
||||
/* update the stream connector, channels, and possibly wake the stream up */
|
||||
cs_notify(cs);
|
||||
stream_release_buffers(__cs_strm(cs));
|
||||
stream_release_buffers(__sc_strm(cs));
|
||||
|
||||
/* cs_notify may have passed through chk_snd and released some
|
||||
* RXBLK flags. Process_stream will consider those flags to wake up the
|
||||
|
@ -1188,11 +1188,11 @@ int conn_send_proxy(struct connection *conn, unsigned int flag)
|
||||
* send a LOCAL line (eg: for use with health checks).
|
||||
*/
|
||||
|
||||
if (cs && cs_strm(cs)) {
|
||||
if (cs && sc_strm(cs)) {
|
||||
ret = make_proxy_line(trash.area, trash.size,
|
||||
objt_server(conn->target),
|
||||
cs_conn(cs_opposite(cs)),
|
||||
__cs_strm(cs));
|
||||
__sc_strm(cs));
|
||||
}
|
||||
else {
|
||||
/* The target server expects a LOCAL line to be sent first. Retrieving
|
||||
|
@ -251,9 +251,9 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx)
|
||||
if (task->process == process_stream && task->context)
|
||||
s = (struct stream *)task->context;
|
||||
else if (task->process == task_run_applet && task->context)
|
||||
s = cs_strm(appctx_cs((struct appctx *)task->context));
|
||||
s = sc_strm(appctx_cs((struct appctx *)task->context));
|
||||
else if (task->process == cs_conn_io_cb && task->context)
|
||||
s = cs_strm(((struct stconn *)task->context));
|
||||
s = sc_strm(((struct stconn *)task->context));
|
||||
|
||||
if (s)
|
||||
stream_dump(buf, s, pfx, '\n');
|
||||
|
@ -1400,7 +1400,7 @@ spoe_handle_connect_appctx(struct appctx *appctx)
|
||||
if (!cs_state_in(cs->state, SC_SB_RDY|SC_SB_EST)) {
|
||||
/* not connected yet */
|
||||
cs_rx_endp_more(cs);
|
||||
task_wakeup(__cs_strm(cs)->task, TASK_WOKEN_MSG);
|
||||
task_wakeup(__sc_strm(cs)->task, TASK_WOKEN_MSG);
|
||||
goto stop;
|
||||
}
|
||||
|
||||
@ -1706,7 +1706,7 @@ static int
|
||||
spoe_handle_processing_appctx(struct appctx *appctx)
|
||||
{
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct server *srv = objt_server(__cs_strm(cs)->target);
|
||||
struct server *srv = objt_server(__sc_strm(cs)->target);
|
||||
struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
|
||||
int ret, skip_sending = 0, skip_receiving = 0, active_s = 0, active_r = 0, close_asap = 0;
|
||||
|
||||
|
14
src/hlua.c
14
src/hlua.c
@ -1941,7 +1941,7 @@ static void hlua_socket_handler(struct appctx *appctx)
|
||||
sc_ic(cs)->flags |= CF_READ_NULL;
|
||||
notification_wake(&ctx->wake_on_read);
|
||||
notification_wake(&ctx->wake_on_write);
|
||||
stream_shutdown(__cs_strm(cs), SF_ERR_KILLED);
|
||||
stream_shutdown(__sc_strm(cs), SF_ERR_KILLED);
|
||||
}
|
||||
|
||||
/* If we can't write, wakeup the pending write signals. */
|
||||
@ -2402,7 +2402,7 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext
|
||||
csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
|
||||
appctx = csk_ctx->appctx;
|
||||
cs = appctx_cs(appctx);
|
||||
s = __cs_strm(cs);
|
||||
s = __sc_strm(cs);
|
||||
|
||||
/* Check for connection close. */
|
||||
if (channel_output_closed(&s->req)) {
|
||||
@ -2843,7 +2843,7 @@ __LJMP static int hlua_socket_connect(struct lua_State *L)
|
||||
csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
|
||||
appctx = csk_ctx->appctx;
|
||||
cs = appctx_cs(appctx);
|
||||
s = __cs_strm(cs);
|
||||
s = __sc_strm(cs);
|
||||
|
||||
if (!sockaddr_alloc(&cs_opposite(cs)->dst, addr, sizeof(*addr))) {
|
||||
xref_unlock(&socket->xref, peer);
|
||||
@ -9217,7 +9217,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx)
|
||||
{
|
||||
struct hlua_tcp_ctx *tcp_ctx = applet_reserve_svcctx(ctx, sizeof(*tcp_ctx));
|
||||
struct stconn *cs = appctx_cs(ctx);
|
||||
struct stream *strm = __cs_strm(cs);
|
||||
struct stream *strm = __sc_strm(cs);
|
||||
struct hlua *hlua;
|
||||
struct task *task;
|
||||
char **arg;
|
||||
@ -9315,7 +9315,7 @@ void hlua_applet_tcp_fct(struct appctx *ctx)
|
||||
{
|
||||
struct hlua_tcp_ctx *tcp_ctx = ctx->svcctx;
|
||||
struct stconn *cs = appctx_cs(ctx);
|
||||
struct stream *strm = __cs_strm(cs);
|
||||
struct stream *strm = __sc_strm(cs);
|
||||
struct channel *res = sc_ic(cs);
|
||||
struct act_rule *rule = ctx->rule;
|
||||
struct proxy *px = strm->be;
|
||||
@ -9408,7 +9408,7 @@ static int hlua_applet_http_init(struct appctx *ctx)
|
||||
{
|
||||
struct hlua_http_ctx *http_ctx = applet_reserve_svcctx(ctx, sizeof(*http_ctx));
|
||||
struct stconn *cs = appctx_cs(ctx);
|
||||
struct stream *strm = __cs_strm(cs);
|
||||
struct stream *strm = __sc_strm(cs);
|
||||
struct http_txn *txn;
|
||||
struct hlua *hlua;
|
||||
char **arg;
|
||||
@ -9511,7 +9511,7 @@ void hlua_applet_http_fct(struct appctx *ctx)
|
||||
{
|
||||
struct hlua_http_ctx *http_ctx = ctx->svcctx;
|
||||
struct stconn *cs = appctx_cs(ctx);
|
||||
struct stream *strm = __cs_strm(cs);
|
||||
struct stream *strm = __sc_strm(cs);
|
||||
struct channel *req = sc_oc(cs);
|
||||
struct channel *res = sc_ic(cs);
|
||||
struct act_rule *rule = ctx->rule;
|
||||
|
@ -637,7 +637,7 @@ static void httpclient_applet_io_handler(struct appctx *appctx)
|
||||
{
|
||||
struct httpclient *hc = appctx->svcctx;
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct channel *req = &s->req;
|
||||
struct channel *res = &s->res;
|
||||
struct htx_blk *blk = NULL;
|
||||
|
@ -3560,7 +3560,7 @@ static void syslog_io_handler(struct appctx *appctx)
|
||||
{
|
||||
static THREAD_LOCAL struct ist metadata[LOG_META_FIELDS];
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct proxy *frontend = strm_fe(s);
|
||||
struct listener *l = strm_li(s);
|
||||
struct buffer *buf = get_trash_chunk();
|
||||
|
@ -1236,8 +1236,8 @@ static int fcgi_set_default_param(struct fcgi_conn *fconn, struct fcgi_strm *fst
|
||||
struct fcgi_strm_params *params)
|
||||
{
|
||||
struct connection *cli_conn = objt_conn(fstrm->sess->origin);
|
||||
const struct sockaddr_storage *src = (cs_check(fcgi_strm_sc(fstrm)) ? conn_src(fconn->conn) : cs_src(cs_opposite(fcgi_strm_sc(fstrm))));
|
||||
const struct sockaddr_storage *dst = (cs_check(fcgi_strm_sc(fstrm)) ? conn_dst(fconn->conn) : cs_dst(cs_opposite(fcgi_strm_sc(fstrm))));
|
||||
const struct sockaddr_storage *src = (sc_check(fcgi_strm_sc(fstrm)) ? conn_src(fconn->conn) : cs_src(cs_opposite(fcgi_strm_sc(fstrm))));
|
||||
const struct sockaddr_storage *dst = (sc_check(fcgi_strm_sc(fstrm)) ? conn_dst(fconn->conn) : cs_dst(cs_opposite(fcgi_strm_sc(fstrm))));
|
||||
struct ist p;
|
||||
|
||||
if (!sl)
|
||||
@ -3319,11 +3319,11 @@ static void fcgi_strm_capture_bad_message(struct fcgi_conn *fconn, struct fcgi_s
|
||||
struct proxy *other_end;
|
||||
union error_snapshot_ctx ctx;
|
||||
|
||||
if (fcgi_strm_sc(fstrm) && cs_strm(fcgi_strm_sc(fstrm))) {
|
||||
if (fcgi_strm_sc(fstrm) && sc_strm(fcgi_strm_sc(fstrm))) {
|
||||
if (sess == NULL)
|
||||
sess = __cs_strm(fcgi_strm_sc(fstrm))->sess;
|
||||
sess = __sc_strm(fcgi_strm_sc(fstrm))->sess;
|
||||
if (!(h1m->flags & H1_MF_RESP))
|
||||
other_end = __cs_strm(fcgi_strm_sc(fstrm))->be;
|
||||
other_end = __sc_strm(fcgi_strm_sc(fstrm))->be;
|
||||
else
|
||||
other_end = sess->fe;
|
||||
} else
|
||||
|
@ -1418,11 +1418,11 @@ static void h1_capture_bad_message(struct h1c *h1c, struct h1s *h1s,
|
||||
struct proxy *other_end;
|
||||
union error_snapshot_ctx ctx;
|
||||
|
||||
if ((h1c->flags & H1C_F_ST_ATTACHED) && cs_strm(h1s_sc(h1s))) {
|
||||
if ((h1c->flags & H1C_F_ST_ATTACHED) && sc_strm(h1s_sc(h1s))) {
|
||||
if (sess == NULL)
|
||||
sess = __cs_strm(h1s_sc(h1s))->sess;
|
||||
sess = __sc_strm(h1s_sc(h1s))->sess;
|
||||
if (!(h1m->flags & H1_MF_RESP))
|
||||
other_end = __cs_strm(h1s_sc(h1s))->be;
|
||||
other_end = __sc_strm(h1s_sc(h1s))->be;
|
||||
else
|
||||
other_end = sess->fe;
|
||||
} else
|
||||
|
@ -2851,7 +2851,7 @@ static inline void init_connected_peer(struct peer *peer, struct peers *peers)
|
||||
static void peer_io_handler(struct appctx *appctx)
|
||||
{
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct peers *curpeers = strm_fe(s)->parent;
|
||||
struct peer *curpeer = NULL;
|
||||
int reql = 0;
|
||||
@ -3818,7 +3818,7 @@ static int peers_dump_peer(struct buffer *msg, struct stconn *cs, struct peer *p
|
||||
appctx->t ? appctx->t->calls : 0);
|
||||
|
||||
peer_cs = appctx_cs(peer->appctx);
|
||||
peer_s = __cs_strm(peer_cs);
|
||||
peer_s = __sc_strm(peer_cs);
|
||||
|
||||
chunk_appendf(&trash, " state=%s", cs_state_str(cs_opposite(peer_cs)->state));
|
||||
|
||||
|
@ -300,7 +300,7 @@ void sink_setup_proxy(struct proxy *px)
|
||||
static void sink_forward_io_handler(struct appctx *appctx)
|
||||
{
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct sink *sink = strm_fe(s)->parent;
|
||||
struct sink_forward_target *sft = appctx->svcctx;
|
||||
struct ring *ring = sink->ctx.ring;
|
||||
@ -439,7 +439,7 @@ static void sink_forward_io_handler(struct appctx *appctx)
|
||||
static void sink_forward_oc_io_handler(struct appctx *appctx)
|
||||
{
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct sink *sink = strm_fe(s)->parent;
|
||||
struct sink_forward_target *sft = appctx->svcctx;
|
||||
struct ring *ring = sink->ctx.ring;
|
||||
|
10
src/stats.c
10
src/stats.c
@ -3018,7 +3018,7 @@ int stats_dump_proxy_to_buffer(struct stconn *cs, struct htx *htx,
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct channel *rep = sc_ic(cs);
|
||||
struct server *sv, *svs; /* server and server-state, server-state=server or server->track */
|
||||
struct listener *l;
|
||||
@ -3827,7 +3827,7 @@ static int stats_dump_stat_to_buffer(struct stconn *cs, struct htx *htx,
|
||||
*/
|
||||
static int stats_process_http_post(struct stconn *cs)
|
||||
{
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
|
||||
@ -4163,7 +4163,7 @@ static int stats_process_http_post(struct stconn *cs)
|
||||
|
||||
static int stats_send_http_headers(struct stconn *cs, struct htx *htx)
|
||||
{
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct uri_auth *uri = s->be->uri_auth;
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
@ -4218,7 +4218,7 @@ static int stats_send_http_headers(struct stconn *cs, struct htx *htx)
|
||||
static int stats_send_http_redirect(struct stconn *cs, struct htx *htx)
|
||||
{
|
||||
char scope_txt[STAT_SCOPE_TXT_MAXLEN + sizeof STAT_SCOPE_PATTERN];
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct uri_auth *uri = s->be->uri_auth;
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
@ -4284,7 +4284,7 @@ static void http_stats_io_handler(struct appctx *appctx)
|
||||
{
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct channel *req = sc_oc(cs);
|
||||
struct channel *res = sc_ic(cs);
|
||||
struct htx *req_htx, *res_htx;
|
||||
|
@ -4242,7 +4242,7 @@ static int table_dump_head_to_buffer(struct buffer *msg,
|
||||
struct appctx *appctx,
|
||||
struct stktable *t, struct stktable *target)
|
||||
{
|
||||
struct stream *s = __cs_strm(appctx_cs(appctx));
|
||||
struct stream *s = __sc_strm(appctx_cs(appctx));
|
||||
|
||||
chunk_appendf(msg, "# table: %s, type: %s, size:%d, used:%d\n",
|
||||
t->id, stktable_types[t->type].kw, t->size, t->current);
|
||||
@ -4664,7 +4664,7 @@ static int cli_io_handler_table(struct appctx *appctx)
|
||||
{
|
||||
struct show_table_ctx *ctx = appctx->svcctx;
|
||||
struct stconn *cs = appctx_cs(appctx);
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct ebmb_node *eb;
|
||||
int skip_entry;
|
||||
int show = ctx->action == STK_CLI_ACT_SHOW;
|
||||
|
@ -277,7 +277,7 @@ static void strm_trace(enum trace_level level, uint64_t mask, const struct trace
|
||||
*/
|
||||
int stream_upgrade_from_cs(struct stconn *cs, struct buffer *input)
|
||||
{
|
||||
struct stream *s = __cs_strm(cs);
|
||||
struct stream *s = __sc_strm(cs);
|
||||
const struct mux_ops *mux = cs_conn_mux(cs);
|
||||
|
||||
if (mux) {
|
||||
|
Loading…
Reference in New Issue
Block a user