CLEANUP: stconn: rename cs_{i,o}{b,c} to sc_{i,o}{b,c}

We're starting to propagate the stream connector's new name through the
API. Most call places of these functions that retrieve the channel or its
buffer are in applets. The local variable names are not changed in order
to keep the changes small and reviewable. There were ~92 uses of cs_ic(),
~96 of cs_oc() (due to co_get*() being less factorizable than ci_put*),
and ~5 accesses to the buffer itself.
This commit is contained in:
Willy Tarreau 2022-05-18 15:55:18 +02:00
parent d0a06d52f4
commit 40a9c32e3a
27 changed files with 197 additions and 197 deletions

View File

@ -558,7 +558,7 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx)
static struct ist prefix = IST("haproxy_process_");
struct promex_ctx *ctx = appctx->svcctx;
struct field val;
struct channel *chn = cs_ic(appctx_cs(appctx));
struct channel *chn = sc_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
int ret = 1;
@ -610,7 +610,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
struct promex_ctx *ctx = appctx->svcctx;
struct proxy *px;
struct field val;
struct channel *chn = cs_ic(appctx_cs(appctx));
struct channel *chn = sc_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@ -711,7 +711,7 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx)
struct promex_ctx *ctx = appctx->svcctx;
struct proxy *px;
struct field val;
struct channel *chn = cs_ic(appctx_cs(appctx));
struct channel *chn = sc_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@ -803,7 +803,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
struct proxy *px;
struct server *sv;
struct field val;
struct channel *chn = cs_ic(appctx_cs(appctx));
struct channel *chn = sc_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@ -957,7 +957,7 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
struct proxy *px;
struct server *sv;
struct field val;
struct channel *chn = cs_ic(appctx_cs(appctx));
struct channel *chn = sc_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@ -1127,7 +1127,7 @@ static int promex_dump_sticktable_metrics(struct appctx *appctx, struct htx *htx
static struct ist prefix = IST("haproxy_sticktable_");
struct promex_ctx *ctx = appctx->svcctx;
struct field val;
struct channel *chn = cs_ic(appctx_cs(appctx));
struct channel *chn = sc_ic(appctx_cs(appctx));
struct ist out = ist2(trash.area, 0);
size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
int ret = 1;
@ -1356,8 +1356,8 @@ static int promex_dump_metrics(struct appctx *appctx, struct stconn *cs, struct
static int promex_parse_uri(struct appctx *appctx, struct stconn *cs)
{
struct promex_ctx *ctx = appctx->svcctx;
struct channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
struct channel *req = sc_oc(cs);
struct channel *res = sc_ic(cs);
struct htx *req_htx, *res_htx;
struct htx_sl *sl;
char *p, *key, *value;
@ -1466,7 +1466,7 @@ static int promex_parse_uri(struct appctx *appctx, struct stconn *cs)
* full. */
static int promex_send_headers(struct appctx *appctx, struct stconn *cs, struct htx *htx)
{
struct channel *chn = cs_ic(cs);
struct channel *chn = sc_ic(cs);
struct htx_sl *sl;
unsigned int flags;
@ -1505,8 +1505,8 @@ static void promex_appctx_handle_io(struct appctx *appctx)
{
struct stconn *cs = appctx_cs(appctx);
struct stream *s = __cs_strm(cs);
struct channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
struct channel *req = sc_oc(cs);
struct channel *res = sc_ic(cs);
struct htx *req_htx, *res_htx;
int ret;

View File

@ -137,7 +137,7 @@ static inline int applet_putchk(struct appctx *appctx, struct buffer *chunk)
struct sedesc *se = appctx->sedesc;
int ret;
ret = ci_putchk(cs_ic(se->sc), chunk);
ret = ci_putchk(sc_ic(se->sc), chunk);
if (ret == -1)
se_fl_set(se, SE_FL_RXBLK_ROOM);
@ -153,7 +153,7 @@ static inline int applet_putblk(struct appctx *appctx, const char *blk, int len)
struct sedesc *se = appctx->sedesc;
int ret;
ret = ci_putblk(cs_ic(se->sc), blk, len);
ret = ci_putblk(sc_ic(se->sc), blk, len);
if (ret == -1)
se_fl_set(se, SE_FL_RXBLK_ROOM);
@ -170,7 +170,7 @@ static inline int applet_putstr(struct appctx *appctx, const char *str)
struct sedesc *se = appctx->sedesc;
int ret;
ret = ci_putstr(cs_ic(se->sc), str);
ret = ci_putstr(sc_ic(se->sc), str);
if (ret == -1)
se_fl_set(se, SE_FL_RXBLK_ROOM);
@ -186,7 +186,7 @@ static inline int applet_putchr(struct appctx *appctx, char chr)
struct sedesc *se = appctx->sedesc;
int ret;
ret = ci_putchr(cs_ic(se->sc), chr);
ret = ci_putchr(sc_ic(se->sc), chr);
if (ret == -1)
se_fl_set(se, SE_FL_RXBLK_ROOM);

View File

@ -42,7 +42,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 *cs_ic(struct stconn *cs)
static inline struct channel *sc_ic(struct stconn *cs)
{
struct stream *strm = __cs_strm(cs);
@ -50,7 +50,7 @@ static inline struct channel *cs_ic(struct stconn *cs)
}
/* returns the channel which feeds data to this stream connector (output channel) */
static inline struct channel *cs_oc(struct stconn *cs)
static inline struct channel *sc_oc(struct stconn *cs)
{
struct stream *strm = __cs_strm(cs);
@ -58,15 +58,15 @@ static inline struct channel *cs_oc(struct stconn *cs)
}
/* returns the buffer which receives data from this stream connector (input channel's buffer) */
static inline struct buffer *cs_ib(struct stconn *cs)
static inline struct buffer *sc_ib(struct stconn *cs)
{
return &cs_ic(cs)->buf;
return &sc_ic(cs)->buf;
}
/* returns the buffer which feeds data to this stream connector (output channel's buffer) */
static inline struct buffer *cs_ob(struct stconn *cs)
static inline struct buffer *sc_ob(struct stconn *cs)
{
return &cs_oc(cs)->buf;
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)
@ -91,8 +91,8 @@ 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;
cs_oc(cs)->flags |= CF_WRITE_ERROR;
cs_ic(cs)->flags |= CF_READ_ERROR;
sc_oc(cs)->flags |= CF_WRITE_ERROR;
sc_ic(cs)->flags |= CF_READ_ERROR;
}
/* sets the current and previous state of a stream connector to <state>. This is
@ -158,7 +158,7 @@ static inline int cs_alloc_ibuf(struct stconn *cs, struct buffer_wait *wait)
{
int ret;
ret = channel_alloc_buffer(cs_ic(cs), wait);
ret = channel_alloc_buffer(sc_ic(cs), wait);
if (!ret)
cs_rx_buff_blk(cs);
return ret;

View File

@ -627,7 +627,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
int max_lines;
int i, max;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
return 1;
chunk_reset(&trash);
@ -851,7 +851,7 @@ static int cli_io_handler_show_tasks(struct appctx *appctx)
int thr, queue;
int i, max;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
return 1;
/* It's not possible to scan queues in small chunks and yield in the

View File

@ -173,11 +173,11 @@ int appctx_buf_available(void *arg)
cs_rx_buff_rdy(cs);
/* was already allocated another way ? if so, don't take this one */
if (c_size(cs_ic(cs)) || cs_ic(cs)->pipe)
if (c_size(sc_ic(cs)) || sc_ic(cs)->pipe)
return 0;
/* allocation possible now ? */
if (!b_alloc(&cs_ic(cs)->buf)) {
if (!b_alloc(&sc_ic(cs)->buf)) {
cs_rx_buff_blk(cs);
return 0;
}
@ -230,29 +230,29 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state)
if (!cs_alloc_ibuf(cs, &app->buffer_wait))
cs_rx_endp_more(cs);
count = co_data(cs_oc(cs));
count = co_data(sc_oc(cs));
app->applet->fct(app);
/* now check if the applet has released some room and forgot to
* notify the other side about it.
*/
if (count != co_data(cs_oc(cs))) {
cs_oc(cs)->flags |= CF_WRITE_PARTIAL | CF_WROTE_DATA;
if (count != co_data(sc_oc(cs))) {
sc_oc(cs)->flags |= CF_WRITE_PARTIAL | CF_WROTE_DATA;
cs_rx_room_rdy(cs_opposite(cs));
}
/* 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->sedesc, 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->sedesc, 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
((b_size(sc_ib(cs)) && se_fl_test(app->sedesc, SE_FL_RXBLK_BUFF)) || // asks for a buffer which is present
(b_size(sc_ib(cs)) && !b_data(sc_ib(cs)) && se_fl_test(app->sedesc, SE_FL_RXBLK_ROOM)) || // asks for room in an empty buffer
(b_data(sc_ob(cs)) && cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)) || // asks for data already present
(!b_data(sc_ib(cs)) && b_data(sc_ob(cs)) && // didn't return anything ...
(sc_oc(cs)->flags & (CF_WRITE_PARTIAL|CF_SHUTW_NOW)) == CF_SHUTW_NOW))) { // ... and left data pending after a shut
stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));
}
cs->app_ops->wake(cs);
channel_release_buffer(cs_ic(cs), &app->buffer_wait);
channel_release_buffer(sc_ic(cs), &app->buffer_wait);
return t;
}

View File

@ -1802,7 +1802,7 @@ skip_reuse:
*/
((cli_conn->flags & CO_FL_EARLY_DATA) ||
((s->be->retry_type & PR_RE_EARLY_ERROR) && !s->conn_retries)) &&
!channel_is_empty(cs_oc(s->scb)) &&
!channel_is_empty(sc_oc(s->scb)) &&
srv_conn->flags & CO_FL_SSL_WAIT_HS)
srv_conn->flags &= ~(CO_FL_SSL_WAIT_HS | CO_FL_WAIT_L6_CONN);
#endif
@ -1839,7 +1839,7 @@ skip_reuse:
if (!cs_state_in(s->scb->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO) &&
(srv_conn->flags & CO_FL_WAIT_XPRT) == 0) {
s->conn_exp = TICK_ETERNITY;
cs_oc(s->scb)->flags |= CF_WRITE_NULL;
sc_oc(s->scb)->flags |= CF_WRITE_NULL;
if (s->scb->state == SC_ST_CON)
s->scb->state = SC_ST_RDY;
}
@ -1851,8 +1851,8 @@ skip_reuse:
* wake callback. Otherwise si_cs_recv()/si_cs_send() already take
* care of it.
*/
if (sc_ep_test(s->scb, SE_FL_EOI) && !(cs_ic(s->scb)->flags & CF_EOI))
cs_ic(s->scb)->flags |= (CF_EOI|CF_READ_PARTIAL);
if (sc_ep_test(s->scb, SE_FL_EOI) && !(sc_ic(s->scb)->flags & CF_EOI))
sc_ic(s->scb)->flags |= (CF_EOI|CF_READ_PARTIAL);
/* catch all sync connect while the mux is not already installed */
if (!srv_conn->mux && !(srv_conn->flags & CO_FL_WAIT_XPRT)) {

View File

@ -1294,7 +1294,7 @@ static unsigned int htx_cache_dump_blk(struct appctx *appctx, struct htx *htx, e
uint32_t blksz;
max = htx_get_max_blksz(htx,
channel_htx_recv_max(cs_ic(appctx_cs(appctx)), htx));
channel_htx_recv_max(sc_ic(appctx_cs(appctx)), htx));
if (!max)
return 0;
blksz = ((type == HTX_BLK_HDR || type == HTX_BLK_TLR)
@ -1338,7 +1338,7 @@ static unsigned int htx_cache_dump_data_blk(struct appctx *appctx, struct htx *h
uint32_t blksz;
max = htx_get_max_blksz(htx,
channel_htx_recv_max(cs_ic(appctx_cs(appctx)), htx));
channel_htx_recv_max(sc_ic(appctx_cs(appctx)), htx));
if (!max)
return 0;
@ -1456,8 +1456,8 @@ static void http_cache_io_handler(struct appctx *appctx)
struct cache_entry *cache_ptr = ctx->entry;
struct shared_block *first = block_ptr(cache_ptr);
struct stconn *cs = appctx_cs(appctx);
struct channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
struct channel *req = sc_oc(cs);
struct channel *res = sc_ic(cs);
struct htx *req_htx, *res_htx;
struct buffer *errmsg;
unsigned int len;

View File

@ -898,8 +898,8 @@ static int cli_output_msg(struct channel *chn, const char *msg, int severity, in
static void cli_io_handler(struct appctx *appctx)
{
struct stconn *cs = appctx_cs(appctx);
struct channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
struct channel *req = sc_oc(cs);
struct channel *res = sc_ic(cs);
struct bind_conf *bind_conf = strm_li(__cs_strm(cs))->bind_conf;
int reql;
int len;
@ -950,7 +950,7 @@ static void cli_io_handler(struct appctx *appctx)
/* ensure we have some output room left in the event we
* would want to return some info right after parsing.
*/
if (buffer_almost_full(cs_ib(cs))) {
if (buffer_almost_full(sc_ib(cs))) {
cs_rx_room_blk(cs);
break;
}
@ -962,10 +962,10 @@ static void cli_io_handler(struct appctx *appctx)
*/
if (appctx->st1 & APPCTX_CLI_ST1_PAYLOAD)
reql = co_getline(cs_oc(cs), str,
reql = co_getline(sc_oc(cs), str,
appctx->chunk->size - appctx->chunk->data - 1);
else
reql = co_getdelim(cs_oc(cs), str,
reql = co_getdelim(sc_oc(cs), str,
appctx->chunk->size - appctx->chunk->data - 1,
"\n;", '\\');
@ -1050,7 +1050,7 @@ static void cli_io_handler(struct appctx *appctx)
}
/* re-adjust req buffer */
co_skip(cs_oc(cs), reql);
co_skip(sc_oc(cs), reql);
req->flags |= CF_READ_DONTWAIT; /* we plan to read small requests */
}
else { /* output functions */
@ -1161,7 +1161,7 @@ static void cli_io_handler(struct appctx *appctx)
* refills the buffer with new bytes in non-interactive
* mode, avoiding to close on apparently empty commands.
*/
if (co_data(cs_oc(cs))) {
if (co_data(sc_oc(cs))) {
appctx_wakeup(appctx);
goto out;
}
@ -1227,7 +1227,7 @@ static int cli_io_handler_show_env(struct appctx *appctx)
struct stconn *cs = appctx_cs(appctx);
char **var = ctx->var;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
return 1;
chunk_reset(&trash);
@ -1264,7 +1264,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
int fd = fdctx->fd;
int ret = 1;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
goto end;
chunk_reset(&trash);
@ -1461,7 +1461,7 @@ static int cli_io_handler_show_activity(struct appctx *appctx)
struct stconn *cs = appctx_cs(appctx);
int thr;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
return 1;
chunk_reset(&trash);
@ -2169,7 +2169,7 @@ static int cli_parse_simple(char **args, char *payload, struct appctx *appctx, v
void pcli_write_prompt(struct stream *s)
{
struct buffer *msg = get_trash_chunk();
struct channel *oc = cs_oc(s->scf);
struct channel *oc = sc_oc(s->scf);
if (!(s->pcli_flags & PCLI_F_PROMPT))
return;

View File

@ -505,7 +505,7 @@ struct appctx *cs_applet_create(struct stconn *cs, struct applet *app)
*/
static void sc_app_shutr(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *ic = sc_ic(cs);
cs_rx_shut_blk(cs);
if (ic->flags & CF_SHUTR)
@ -516,7 +516,7 @@ static void sc_app_shutr(struct stconn *cs)
if (!cs_state_in(cs->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
return;
if (cs_oc(cs)->flags & CF_SHUTW) {
if (sc_oc(cs)->flags & CF_SHUTW) {
cs->state = SC_ST_DIS;
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
}
@ -539,8 +539,8 @@ static void sc_app_shutr(struct stconn *cs)
*/
static void sc_app_shutw(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *oc = cs_oc(cs);
struct channel *ic = sc_ic(cs);
struct channel *oc = sc_oc(cs);
oc->flags &= ~CF_SHUTW_NOW;
if (oc->flags & CF_SHUTW)
@ -591,11 +591,11 @@ static void sc_app_shutw(struct stconn *cs)
/* default chk_rcv function for scheduled tasks */
static void sc_app_chk_rcv(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *ic = sc_ic(cs);
DPRINTF(stderr, "%s: cs=%p, cs->state=%d ic->flags=%08x oc->flags=%08x\n",
__FUNCTION__,
cs, cs->state, ic->flags, cs_oc(cs)->flags);
cs, cs->state, ic->flags, sc_oc(cs)->flags);
if (ic->pipe) {
/* stop reading */
@ -611,11 +611,11 @@ static void sc_app_chk_rcv(struct stconn *cs)
/* default chk_snd function for scheduled tasks */
static void sc_app_chk_snd(struct stconn *cs)
{
struct channel *oc = cs_oc(cs);
struct channel *oc = sc_oc(cs);
DPRINTF(stderr, "%s: cs=%p, cs->state=%d ic->flags=%08x oc->flags=%08x\n",
__FUNCTION__,
cs, cs->state, cs_ic(cs)->flags, oc->flags);
cs, cs->state, sc_ic(cs)->flags, oc->flags);
if (unlikely(cs->state != SC_ST_EST || (oc->flags & CF_SHUTW)))
return;
@ -647,7 +647,7 @@ static void sc_app_chk_snd(struct stconn *cs)
*/
static void sc_app_shutr_conn(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *ic = sc_ic(cs);
BUG_ON(!cs_conn(cs));
@ -660,7 +660,7 @@ static void sc_app_shutr_conn(struct stconn *cs)
if (!cs_state_in(cs->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
return;
if (cs_oc(cs)->flags & CF_SHUTW) {
if (sc_oc(cs)->flags & CF_SHUTW) {
cs_conn_shut(cs);
cs->state = SC_ST_DIS;
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
@ -681,8 +681,8 @@ static void sc_app_shutr_conn(struct stconn *cs)
*/
static void sc_app_shutw_conn(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *oc = cs_oc(cs);
struct channel *ic = sc_ic(cs);
struct channel *oc = sc_oc(cs);
BUG_ON(!cs_conn(cs));
@ -776,7 +776,7 @@ static void sc_app_chk_rcv_conn(struct stconn *cs)
*/
static void sc_app_chk_snd_conn(struct stconn *cs)
{
struct channel *oc = cs_oc(cs);
struct channel *oc = sc_oc(cs);
BUG_ON(!cs_conn(cs));
@ -791,7 +791,7 @@ static void sc_app_chk_snd_conn(struct stconn *cs)
!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)))
if (!(cs->wait_event.events & SUB_RETRY_SEND) && !channel_is_empty(sc_oc(cs)))
cs_conn_send(cs);
if (sc_ep_test(cs, SE_FL_ERROR | SE_FL_ERR_PENDING) || cs_is_conn_error(cs)) {
@ -831,7 +831,7 @@ static void sc_app_chk_snd_conn(struct stconn *cs)
}
if (likely(oc->flags & CF_WRITE_ACTIVITY)) {
struct channel *ic = cs_ic(cs);
struct channel *ic = sc_ic(cs);
/* update timeout if we have written something */
if ((oc->flags & (CF_SHUTW|CF_WRITE_PARTIAL)) == CF_WRITE_PARTIAL &&
@ -874,7 +874,7 @@ static void sc_app_chk_snd_conn(struct stconn *cs)
*/
static void sc_app_shutr_applet(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *ic = sc_ic(cs);
BUG_ON(!cs_appctx(cs));
@ -889,7 +889,7 @@ static void sc_app_shutr_applet(struct stconn *cs)
if (!cs_state_in(cs->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
return;
if (cs_oc(cs)->flags & CF_SHUTW) {
if (sc_oc(cs)->flags & CF_SHUTW) {
appctx_shut(__cs_appctx(cs));
cs->state = SC_ST_DIS;
__cs_strm(cs)->conn_exp = TICK_ETERNITY;
@ -909,8 +909,8 @@ static void sc_app_shutr_applet(struct stconn *cs)
*/
static void sc_app_shutw_applet(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *oc = cs_oc(cs);
struct channel *ic = sc_ic(cs);
struct channel *oc = sc_oc(cs);
BUG_ON(!cs_appctx(cs));
@ -963,13 +963,13 @@ static void sc_app_shutw_applet(struct stconn *cs)
/* chk_rcv function for applets */
static void sc_app_chk_rcv_applet(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *ic = sc_ic(cs);
BUG_ON(!cs_appctx(cs));
DPRINTF(stderr, "%s: cs=%p, cs->state=%d ic->flags=%08x oc->flags=%08x\n",
__FUNCTION__,
cs, cs->state, ic->flags, cs_oc(cs)->flags);
cs, cs->state, ic->flags, sc_oc(cs)->flags);
if (!ic->pipe) {
/* (re)start reading */
@ -980,13 +980,13 @@ static void sc_app_chk_rcv_applet(struct stconn *cs)
/* chk_snd function for applets */
static void sc_app_chk_snd_applet(struct stconn *cs)
{
struct channel *oc = cs_oc(cs);
struct channel *oc = sc_oc(cs);
BUG_ON(!cs_appctx(cs));
DPRINTF(stderr, "%s: cs=%p, cs->state=%d ic->flags=%08x oc->flags=%08x\n",
__FUNCTION__,
cs, cs->state, cs_ic(cs)->flags, oc->flags);
cs, cs->state, sc_ic(cs)->flags, oc->flags);
if (unlikely(cs->state != SC_ST_EST || (oc->flags & CF_SHUTW)))
return;
@ -1017,7 +1017,7 @@ static void sc_app_chk_snd_applet(struct stconn *cs)
*/
void cs_update_rx(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *ic = sc_ic(cs);
if (ic->flags & CF_SHUTR) {
cs_rx_shut_blk(cs);
@ -1061,8 +1061,8 @@ void cs_update_rx(struct stconn *cs)
*/
void cs_update_tx(struct stconn *cs)
{
struct channel *oc = cs_oc(cs);
struct channel *ic = cs_ic(cs);
struct channel *oc = sc_oc(cs);
struct channel *ic = sc_ic(cs);
if (oc->flags & CF_SHUTW)
return;
@ -1110,8 +1110,8 @@ void cs_update_tx(struct stconn *cs)
*/
static void cs_notify(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *oc = cs_oc(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);
@ -1239,8 +1239,8 @@ static void cs_notify(struct stconn *cs)
*/
static void cs_conn_read0(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *oc = cs_oc(cs);
struct channel *ic = sc_ic(cs);
struct channel *oc = sc_oc(cs);
BUG_ON(!cs_conn(cs));
@ -1289,7 +1289,7 @@ static void cs_conn_read0(struct stconn *cs)
static int cs_conn_recv(struct stconn *cs)
{
struct connection *conn = __cs_conn(cs);
struct channel *ic = cs_ic(cs);
struct channel *ic = sc_ic(cs);
int ret, max, cur_read = 0;
int read_poll = MAX_READ_POLL_LOOPS;
int flags = 0;
@ -1644,7 +1644,7 @@ static int cs_conn_send(struct stconn *cs)
{
struct connection *conn = __cs_conn(cs);
struct stream *s = __cs_strm(cs);
struct channel *oc = cs_oc(cs);
struct channel *oc = sc_oc(cs);
int ret;
int did_send = 0;
@ -1787,7 +1787,7 @@ static int cs_conn_send(struct stconn *cs)
*/
void cs_conn_sync_send(struct stconn *cs)
{
struct channel *oc = cs_oc(cs);
struct channel *oc = sc_oc(cs);
oc->flags &= ~(CF_WRITE_NULL|CF_WRITE_PARTIAL);
@ -1815,8 +1815,8 @@ void cs_conn_sync_send(struct stconn *cs)
static int cs_conn_process(struct stconn *cs)
{
struct connection *conn = __cs_conn(cs);
struct channel *ic = cs_ic(cs);
struct channel *oc = cs_oc(cs);
struct channel *ic = sc_ic(cs);
struct channel *oc = sc_oc(cs);
BUG_ON(!conn);
@ -1908,7 +1908,7 @@ struct task *cs_conn_io_cb(struct task *t, void *ctx, unsigned int state)
if (!cs_conn(cs))
return t;
if (!(cs->wait_event.events & SUB_RETRY_SEND) && !channel_is_empty(cs_oc(cs)))
if (!(cs->wait_event.events & SUB_RETRY_SEND) && !channel_is_empty(sc_oc(cs)))
ret = cs_conn_send(cs);
if (!(cs->wait_event.events & SUB_RETRY_RECV))
ret |= cs_conn_recv(cs);
@ -1926,7 +1926,7 @@ struct task *cs_conn_io_cb(struct task *t, void *ctx, unsigned int state)
*/
static int cs_applet_process(struct stconn *cs)
{
struct channel *ic = cs_ic(cs);
struct channel *ic = sc_ic(cs);
BUG_ON(!cs_appctx(cs));

View File

@ -293,7 +293,7 @@ static int cli_io_handler_show_threads(struct appctx *appctx)
struct stconn *cs = appctx_cs(appctx);
int thr;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
return 1;
if (appctx->st0)
@ -1052,7 +1052,7 @@ static int debug_iohandler_fd(struct appctx *appctx)
int ret = 1;
int i, fd;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
goto end;
chunk_reset(&trash);
@ -1241,7 +1241,7 @@ static int debug_iohandler_memstats(struct appctx *appctx)
struct mem_stats *ptr = ctx->start;
int ret = 1;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
goto end;
chunk_reset(&trash);

View File

@ -460,11 +460,11 @@ static void dns_session_io_handler(struct appctx *appctx)
goto close;
/* an error was detected */
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
goto close;
/* con closed by server side, we will skip data write and drain data from channel */
if ((cs_oc(cs)->flags & CF_SHUTW)) {
if ((sc_oc(cs)->flags & CF_SHUTW)) {
goto read;
}
@ -528,7 +528,7 @@ static void dns_session_io_handler(struct appctx *appctx)
BUG_ON(msg_len + ofs + cnt + 1 > b_data(buf));
/* retrieve available room on output channel */
available_room = channel_recv_max(cs_ic(cs));
available_room = channel_recv_max(sc_ic(cs));
/* tx_msg_offset null means we are at the start of a new message */
if (!ds->tx_msg_offset) {
@ -669,35 +669,35 @@ read:
if (!ds->rx_msg.len) {
/* next message len is not fully available into the channel */
if (co_data(cs_oc(cs)) < 2)
if (co_data(sc_oc(cs)) < 2)
break;
/* retrieve message len */
co_getblk(cs_oc(cs), (char *)&msg_len, 2, 0);
co_getblk(sc_oc(cs), (char *)&msg_len, 2, 0);
/* mark as consumed */
co_skip(cs_oc(cs), 2);
co_skip(sc_oc(cs), 2);
/* store message len */
ds->rx_msg.len = ntohs(msg_len);
}
if (!co_data(cs_oc(cs))) {
if (!co_data(sc_oc(cs))) {
/* we need more data but nothing is available */
break;
}
if (co_data(cs_oc(cs)) + ds->rx_msg.offset < ds->rx_msg.len) {
if (co_data(sc_oc(cs)) + ds->rx_msg.offset < ds->rx_msg.len) {
/* message only partially available */
/* read available data */
co_getblk(cs_oc(cs), ds->rx_msg.area + ds->rx_msg.offset, co_data(cs_oc(cs)), 0);
co_getblk(sc_oc(cs), ds->rx_msg.area + ds->rx_msg.offset, co_data(sc_oc(cs)), 0);
/* update message offset */
ds->rx_msg.offset += co_data(cs_oc(cs));
ds->rx_msg.offset += co_data(sc_oc(cs));
/* consume all pending data from the channel */
co_skip(cs_oc(cs), co_data(cs_oc(cs)));
co_skip(sc_oc(cs), co_data(sc_oc(cs)));
/* we need to wait for more data */
break;
@ -706,10 +706,10 @@ read:
/* enough data is available into the channel to read the message until the end */
/* read from the channel until the end of the message */
co_getblk(cs_oc(cs), ds->rx_msg.area + ds->rx_msg.offset, ds->rx_msg.len - ds->rx_msg.offset, 0);
co_getblk(sc_oc(cs), ds->rx_msg.area + ds->rx_msg.offset, ds->rx_msg.len - ds->rx_msg.offset, 0);
/* consume all data until the end of the message from the channel */
co_skip(cs_oc(cs), ds->rx_msg.len - ds->rx_msg.offset);
co_skip(sc_oc(cs), ds->rx_msg.len - ds->rx_msg.offset);
/* reset reader offset to 0 for next message reand */
ds->rx_msg.offset = 0;
@ -755,7 +755,7 @@ read:
if (!LIST_INLIST(&ds->waiter)) {
/* there is no more pending data to read and the con was closed by the server side */
if (!co_data(cs_oc(cs)) && (cs_oc(cs)->flags & CF_SHUTW)) {
if (!co_data(sc_oc(cs)) && (sc_oc(cs)->flags & CF_SHUTW)) {
goto close;
}
}
@ -766,7 +766,7 @@ read:
close:
cs_shutw(cs);
cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
sc_ic(cs)->flags |= CF_READ_NULL;
}
void dns_queries_flush(struct dns_session *ds)

View File

@ -1147,7 +1147,7 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
memcpy(buf, (char *)&netint, 4);
ret = applet_putblk(appctx, buf, framesz+4);
if (ret <= 0) {
if ((ret == -3 && b_is_null(&cs_ic(cs)->buf)) || ret == -1) {
if ((ret == -3 && b_is_null(&sc_ic(cs)->buf)) || ret == -1) {
/* WT: is this still needed for the case ret==-3 ? */
cs_rx_room_blk(cs);
return 1; /* retry */
@ -1168,14 +1168,14 @@ spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
int ret;
uint32_t netint;
ret = co_getblk(cs_oc(cs), (char *)&netint, 4, 0);
ret = co_getblk(sc_oc(cs), (char *)&netint, 4, 0);
if (ret > 0) {
framesz = ntohl(netint);
if (framesz > SPOE_APPCTX(appctx)->max_frame_size) {
SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_TOO_BIG;
return -1;
}
ret = co_getblk(cs_oc(cs), buf, framesz, 4);
ret = co_getblk(sc_oc(cs), buf, framesz, 4);
}
if (ret <= 0) {
if (ret == 0) {
@ -1303,7 +1303,7 @@ spoe_release_appctx(struct appctx *appctx)
cs_shutw(cs);
cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
sc_ic(cs)->flags |= CF_READ_NULL;
}
/* Destroy the task attached to this applet */
@ -1507,7 +1507,7 @@ spoe_handle_connecting_appctx(struct appctx *appctx)
next:
/* Do not forget to remove processed frame from the output buffer */
if (trash.data)
co_skip(cs_oc(cs), trash.data);
co_skip(sc_oc(cs), trash.data);
SPOE_APPCTX(appctx)->task->expire =
tick_add_ifset(now_ms, agent->timeout.idle);
@ -1697,7 +1697,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip)
/* Do not forget to remove processed frame from the output buffer */
if (trash.data)
co_skip(cs_oc(appctx_cs(appctx)), trash.data);
co_skip(sc_oc(appctx_cs(appctx)), trash.data);
end:
return ret;
}
@ -1932,7 +1932,7 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx)
next:
/* Do not forget to remove processed frame from the output buffer */
if (trash.data)
co_skip(cs_oc(cs), trash.data);
co_skip(sc_oc(cs), trash.data);
return 0;
stop:
@ -2009,7 +2009,7 @@ spoe_handle_appctx(struct appctx *appctx)
cs_shutw(cs);
cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
sc_ic(cs)->flags |= CF_READ_NULL;
/* fall through */
case SPOE_APPCTX_ST_END:

View File

@ -1938,18 +1938,18 @@ static void hlua_socket_handler(struct appctx *appctx)
if (ctx->die) {
cs_shutw(cs);
cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
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);
}
/* If we can't write, wakeup the pending write signals. */
if (channel_output_closed(cs_ic(cs)))
if (channel_output_closed(sc_ic(cs)))
notification_wake(&ctx->wake_on_write);
/* If we can't read, wakeup the pending read signals. */
if (channel_input_closed(cs_oc(cs)))
if (channel_input_closed(sc_oc(cs)))
notification_wake(&ctx->wake_on_read);
/* if the connection is not established, inform the stream that we want
@ -1966,17 +1966,17 @@ static void hlua_socket_handler(struct appctx *appctx)
ctx->connected = 1;
/* Wake the tasks which wants to write if the buffer have available space. */
if (channel_may_recv(cs_ic(cs)))
if (channel_may_recv(sc_ic(cs)))
notification_wake(&ctx->wake_on_write);
/* Wake the tasks which wants to read if the buffer contains data. */
if (!channel_is_empty(cs_oc(cs)))
if (!channel_is_empty(sc_oc(cs)))
notification_wake(&ctx->wake_on_read);
/* Some data were injected in the buffer, notify the stream
* interface.
*/
if (!channel_is_empty(cs_ic(cs)))
if (!channel_is_empty(sc_ic(cs)))
cs_update(cs);
/* If write notifications are registered, we considers we want
@ -4487,7 +4487,7 @@ __LJMP static int hlua_applet_tcp_getline_yield(lua_State *L, int status, lua_KC
size_t len2;
/* Read the maximum amount of data available. */
ret = co_getline_nc(cs_oc(cs), &blk1, &len1, &blk2, &len2);
ret = co_getline_nc(sc_oc(cs), &blk1, &len1, &blk2, &len2);
/* Data not yet available. return yield. */
if (ret == 0) {
@ -4510,7 +4510,7 @@ __LJMP static int hlua_applet_tcp_getline_yield(lua_State *L, int status, lua_KC
luaL_addlstring(&luactx->b, blk2, len2);
/* Consume input channel output buffer data. */
co_skip(cs_oc(cs), len1 + len2);
co_skip(sc_oc(cs), len1 + len2);
luaL_pushresult(&luactx->b);
return 1;
}
@ -4542,7 +4542,7 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont
size_t len2;
/* Read the maximum amount of data available. */
ret = co_getblk_nc(cs_oc(cs), &blk1, &len1, &blk2, &len2);
ret = co_getblk_nc(sc_oc(cs), &blk1, &len1, &blk2, &len2);
/* Data not yet available. return yield. */
if (ret == 0) {
@ -4568,7 +4568,7 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont
*/
luaL_addlstring(&luactx->b, blk1, len1);
luaL_addlstring(&luactx->b, blk2, len2);
co_skip(cs_oc(cs), len1 + len2);
co_skip(sc_oc(cs), len1 + len2);
cs_cant_get(cs);
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0));
@ -4587,7 +4587,7 @@ __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KCont
len -= len2;
/* Consume input channel output buffer data. */
co_skip(cs_oc(cs), len1 + len2);
co_skip(sc_oc(cs), len1 + len2);
/* If there is no other data available, yield waiting for new data. */
if (len > 0) {
@ -4642,7 +4642,7 @@ __LJMP static int hlua_applet_tcp_send_yield(lua_State *L, int status, lua_KCont
const char *str = MAY_LJMP(luaL_checklstring(L, 2, &len));
int l = MAY_LJMP(luaL_checkinteger(L, 3));
struct stconn *cs = appctx_cs(luactx->appctx);
struct channel *chn = cs_ic(cs);
struct channel *chn = sc_ic(cs);
int max;
/* Get the max amount of data which can write as input in the channel. */
@ -4969,7 +4969,7 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K
{
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct stconn *cs = appctx_cs(luactx->appctx);
struct channel *req = cs_oc(cs);
struct channel *req = sc_oc(cs);
struct htx *htx;
struct htx_blk *blk;
size_t count;
@ -5064,7 +5064,7 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon
{
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct stconn *cs = appctx_cs(luactx->appctx);
struct channel *req = cs_oc(cs);
struct channel *req = sc_oc(cs);
struct htx *htx;
struct htx_blk *blk;
size_t count;
@ -5173,7 +5173,7 @@ __LJMP static int hlua_applet_http_send_yield(lua_State *L, int status, lua_KCon
{
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct stconn *cs = appctx_cs(luactx->appctx);
struct channel *res = cs_ic(cs);
struct channel *res = sc_ic(cs);
struct htx *htx = htx_from_buf(&res->buf);
const char *data;
size_t len;
@ -5310,7 +5310,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L)
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct hlua_http_ctx *http_ctx = luactx->appctx->svcctx;
struct stconn *cs = appctx_cs(luactx->appctx);
struct channel *res = cs_ic(cs);
struct channel *res = sc_ic(cs);
struct htx *htx;
struct htx_sl *sl;
struct h1m h1m;
@ -5507,7 +5507,7 @@ __LJMP static int hlua_applet_http_start_response_yield(lua_State *L, int status
{
struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
struct stconn *cs = appctx_cs(luactx->appctx);
struct channel *res = cs_ic(cs);
struct channel *res = sc_ic(cs);
if (co_data(res)) {
cs_rx_room_blk(cs);
@ -9316,7 +9316,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 channel *res = cs_ic(cs);
struct channel *res = sc_ic(cs);
struct act_rule *rule = ctx->rule;
struct proxy *px = strm->be;
struct hlua *hlua = tcp_ctx->hlua;
@ -9324,7 +9324,7 @@ void hlua_applet_tcp_fct(struct appctx *ctx)
/* The applet execution is already done. */
if (tcp_ctx->flags & APPLET_DONE) {
/* eat the whole request */
co_skip(cs_oc(cs), co_data(cs_oc(cs)));
co_skip(sc_oc(cs), co_data(sc_oc(cs)));
return;
}
@ -9339,7 +9339,7 @@ void hlua_applet_tcp_fct(struct appctx *ctx)
tcp_ctx->flags |= APPLET_DONE;
/* eat the whole request */
co_skip(cs_oc(cs), co_data(cs_oc(cs)));
co_skip(sc_oc(cs), co_data(sc_oc(cs)));
res->flags |= CF_READ_NULL;
cs_shutr(cs);
return;
@ -9512,8 +9512,8 @@ 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 channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
struct channel *req = sc_oc(cs);
struct channel *res = sc_ic(cs);
struct act_rule *rule = ctx->rule;
struct proxy *px = strm->be;
struct hlua *hlua = http_ctx->hlua;

View File

@ -227,8 +227,8 @@ static int hc_cli_io_handler(struct appctx *appctx)
if (ctx->flags & HC_CLI_F_RES_BODY) {
int ret;
ret = httpclient_res_xfer(hc, cs_ib(cs));
channel_add_input(cs_ic(cs), ret); /* forward what we put in the buffer channel */
ret = httpclient_res_xfer(hc, sc_ib(cs));
channel_add_input(sc_ic(cs), ret); /* forward what we put in the buffer channel */
if (!httpclient_data(hc)) {/* remove the flag if the buffer was emptied */
ctx->flags &= ~HC_CLI_F_RES_BODY;

View File

@ -3572,14 +3572,14 @@ static void syslog_io_handler(struct appctx *appctx)
size_t size;
max_accept = l->maxaccept ? l->maxaccept : 1;
while (co_data(cs_oc(cs))) {
while (co_data(sc_oc(cs))) {
char c;
if (max_accept <= 0)
goto missing_budget;
max_accept--;
to_skip = co_getchar(cs_oc(cs), &c);
to_skip = co_getchar(sc_oc(cs), &c);
if (!to_skip)
goto missing_data;
else if (to_skip < 0)
@ -3589,7 +3589,7 @@ static void syslog_io_handler(struct appctx *appctx)
/* rfc-6587, Non-Transparent-Framing: messages separated by
* a trailing LF or CR LF
*/
to_skip = co_getline(cs_oc(cs), buf->area, buf->size);
to_skip = co_getline(sc_oc(cs), buf->area, buf->size);
if (!to_skip)
goto missing_data;
else if (to_skip < 0)
@ -3613,7 +3613,7 @@ static void syslog_io_handler(struct appctx *appctx)
char *p = NULL;
int msglen;
to_skip = co_getword(cs_oc(cs), buf->area, buf->size, ' ');
to_skip = co_getword(sc_oc(cs), buf->area, buf->size, ' ');
if (!to_skip)
goto missing_data;
else if (to_skip < 0)
@ -3630,7 +3630,7 @@ static void syslog_io_handler(struct appctx *appctx)
if (msglen > buf->size)
goto parse_error;
msglen = co_getblk(cs_oc(cs), buf->area, msglen, to_skip);
msglen = co_getblk(sc_oc(cs), buf->area, msglen, to_skip);
if (!msglen)
goto missing_data;
else if (msglen < 0)
@ -3643,7 +3643,7 @@ static void syslog_io_handler(struct appctx *appctx)
else
goto parse_error;
co_skip(cs_oc(cs), to_skip);
co_skip(sc_oc(cs), to_skip);
/* update counters */
_HA_ATOMIC_INC(&cum_log_messages);
@ -3657,7 +3657,7 @@ static void syslog_io_handler(struct appctx *appctx)
missing_data:
/* we need more data to read */
cs_oc(cs)->flags |= CF_READ_DONTWAIT;
sc_oc(cs)->flags |= CF_READ_DONTWAIT;
return;
@ -3683,7 +3683,7 @@ close:
cs_shutw(cs);
cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
sc_ic(cs)->flags |= CF_READ_NULL;
return;
}

View File

@ -348,7 +348,7 @@ static int cli_io_handler_pat_list(struct appctx *appctx)
struct stconn *cs = appctx_cs(appctx);
struct pat_ref_elt *elt;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
/* If we're forced to shut down, we might have to remove our
* reference to the last ref_elt being dumped.
*/

View File

@ -516,7 +516,7 @@ static int cli_io_handler_show_proc(struct appctx *appctx)
char *uptime = NULL;
char *reloadtxt = NULL;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
return 1;
chunk_reset(&trash);

View File

@ -1170,7 +1170,7 @@ static inline int peer_getline(struct appctx *appctx)
struct stconn *cs = appctx_cs(appctx);
int n;
n = co_getline(cs_oc(cs), trash.area, trash.size);
n = co_getline(sc_oc(cs), trash.area, trash.size);
if (!n)
return 0;
@ -1184,7 +1184,7 @@ static inline int peer_getline(struct appctx *appctx)
else
trash.area[n - 1] = 0;
co_skip(cs_oc(cs), n);
co_skip(sc_oc(cs), n);
return n;
}
@ -1211,7 +1211,7 @@ static inline int peer_send_msg(struct appctx *appctx,
}
/* message to buffer */
ret = ci_putblk(cs_ic(cs), trash.area, msglen);
ret = ci_putblk(sc_ic(cs), trash.area, msglen);
if (ret <= 0) {
if (ret == -1) {
/* No more write possible */
@ -2024,7 +2024,7 @@ static int peer_treat_updatemsg(struct appctx *appctx, struct peer *p, int updt,
ignore_msg:
/* skip consumed message */
co_skip(cs_oc(cs), totl);
co_skip(sc_oc(cs), totl);
TRACE_DEVEL("leaving in error", PEERS_EV_UPDTMSG);
return 0;
@ -2307,7 +2307,7 @@ static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p,
return 1;
ignore_msg:
co_skip(cs_oc(cs), totl);
co_skip(sc_oc(cs), totl);
return 0;
malformed_exit:
@ -2335,7 +2335,7 @@ static inline int peer_recv_msg(struct appctx *appctx, char *msg_head, size_t ms
struct stconn *cs = appctx_cs(appctx);
char *cur;
reql = co_getblk(cs_oc(cs), msg_head, 2 * sizeof(char), *totl);
reql = co_getblk(sc_oc(cs), msg_head, 2 * sizeof(char), *totl);
if (reql <= 0) /* closed or EOL not found */
goto incomplete;
@ -2349,11 +2349,11 @@ static inline int peer_recv_msg(struct appctx *appctx, char *msg_head, size_t ms
/* Read and Decode message length */
msg_head += *totl;
msg_head_sz -= *totl;
reql = co_data(cs_oc(cs)) - *totl;
reql = co_data(sc_oc(cs)) - *totl;
if (reql > msg_head_sz)
reql = msg_head_sz;
reql = co_getblk(cs_oc(cs), msg_head, reql, *totl);
reql = co_getblk(sc_oc(cs), msg_head, reql, *totl);
if (reql <= 0) /* closed */
goto incomplete;
@ -2379,7 +2379,7 @@ static inline int peer_recv_msg(struct appctx *appctx, char *msg_head, size_t ms
return -1;
}
reql = co_getblk(cs_oc(cs), trash.area, *msg_len, *totl);
reql = co_getblk(sc_oc(cs), trash.area, *msg_len, *totl);
if (reql <= 0) /* closed */
goto incomplete;
*totl += reql;
@ -2388,7 +2388,7 @@ static inline int peer_recv_msg(struct appctx *appctx, char *msg_head, size_t ms
return 1;
incomplete:
if (reql < 0 || (cs_oc(cs)->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
if (reql < 0 || (sc_oc(cs)->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
/* there was an error or the message was truncated */
appctx->st0 = PEER_SESS_ST_END;
return -1;
@ -2860,7 +2860,7 @@ static void peer_io_handler(struct appctx *appctx)
int prev_state;
/* Check if the input buffer is available. */
if (cs_ib(cs)->size == 0) {
if (sc_ib(cs)->size == 0) {
cs_rx_room_blk(cs);
goto out;
}
@ -2997,7 +2997,7 @@ switchstate:
}
}
if (cs_ic(cs)->flags & CF_WRITE_PARTIAL)
if (sc_ic(cs)->flags & CF_WRITE_PARTIAL)
curpeer->statuscode = PEER_SESS_SC_CONNECTEDCODE;
reql = peer_getline(appctx);
@ -3060,7 +3060,7 @@ switchstate:
curpeer->flags |= PEER_F_ALIVE;
/* skip consumed message */
co_skip(cs_oc(cs), totl);
co_skip(sc_oc(cs), totl);
/* loop on that state to peek next message */
goto switchstate;
@ -3129,13 +3129,13 @@ send_msgs:
}
cs_shutw(cs);
cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
sc_ic(cs)->flags |= CF_READ_NULL;
goto out;
}
}
}
out:
cs_oc(cs)->flags |= CF_READ_DONTWAIT;
sc_oc(cs)->flags |= CF_READ_DONTWAIT;
if (curpeer)
HA_SPIN_UNLOCK(PEER_LOCK, &curpeer->lock);

View File

@ -3141,7 +3141,7 @@ static int cli_io_handler_show_errors(struct appctx *appctx)
struct stconn *cs = appctx_cs(appctx);
extern const char *monthname[12];
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
return 1;
chunk_reset(&trash);

View File

@ -2593,7 +2593,7 @@ static int stats_dump_resolv_to_buffer(struct stconn *cs,
struct list *stat_modules)
{
struct appctx *appctx = __cs_appctx(cs);
struct channel *rep = cs_ic(cs);
struct channel *rep = sc_ic(cs);
struct stats_module *mod;
size_t idx = 0;
@ -2628,7 +2628,7 @@ int stats_dump_resolvers(struct stconn *cs,
{
struct appctx *appctx = __cs_appctx(cs);
struct show_stat_ctx *ctx = appctx->svcctx;
struct channel *rep = cs_ic(cs);
struct channel *rep = sc_ic(cs);
struct resolvers *resolver = ctx->obj1;
struct dns_nameserver *ns = ctx->obj2;

View File

@ -298,7 +298,7 @@ int cli_io_handler_show_ring(struct appctx *appctx)
size_t len, cnt;
int ret;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
return 1;
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
@ -373,7 +373,7 @@ int cli_io_handler_show_ring(struct appctx *appctx)
/* we've drained everything and are configured to wait for more
* data or an event (keypress, close)
*/
if (!cs_oc(cs)->output && !(cs_oc(cs)->flags & CF_SHUTW)) {
if (!sc_oc(cs)->output && !(sc_oc(cs)->flags & CF_SHUTW)) {
/* let's be woken up once new data arrive */
HA_RWLOCK_WRLOCK(LOGSRV_LOCK, &ring->lock);
LIST_APPEND(&ring->waiters, &appctx->wait_entry);
@ -382,7 +382,7 @@ int cli_io_handler_show_ring(struct appctx *appctx)
ret = 0;
}
/* always drain all the request */
co_skip(cs_oc(cs), cs_oc(cs)->output);
co_skip(sc_oc(cs), sc_oc(cs)->output);
}
return ret;
}

View File

@ -317,16 +317,16 @@ static void sink_forward_io_handler(struct appctx *appctx)
* and we don't want expire on this case
* with a syslog server
*/
cs_oc(cs)->rex = TICK_ETERNITY;
sc_oc(cs)->rex = TICK_ETERNITY;
/* rto should not change but it seems the case */
cs_oc(cs)->rto = TICK_ETERNITY;
sc_oc(cs)->rto = TICK_ETERNITY;
/* an error was detected */
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
goto close;
/* con closed by server side */
if ((cs_oc(cs)->flags & CF_SHUTW))
if ((sc_oc(cs)->flags & CF_SHUTW))
goto close;
/* if the connection is not established, inform the stream that we want
@ -422,13 +422,13 @@ static void sink_forward_io_handler(struct appctx *appctx)
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
/* always drain data from server */
co_skip(cs_oc(cs), cs_oc(cs)->output);
co_skip(sc_oc(cs), sc_oc(cs)->output);
return;
close:
cs_shutw(cs);
cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
sc_ic(cs)->flags |= CF_READ_NULL;
}
/*
@ -457,16 +457,16 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
* and we don't want expire on this case
* with a syslog server
*/
cs_oc(cs)->rex = TICK_ETERNITY;
sc_oc(cs)->rex = TICK_ETERNITY;
/* rto should not change but it seems the case */
cs_oc(cs)->rto = TICK_ETERNITY;
sc_oc(cs)->rto = TICK_ETERNITY;
/* an error was detected */
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
goto close;
/* con closed by server side */
if ((cs_oc(cs)->flags & CF_SHUTW))
if ((sc_oc(cs)->flags & CF_SHUTW))
goto close;
/* if the connection is not established, inform the stream that we want
@ -566,13 +566,13 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
/* always drain data from server */
co_skip(cs_oc(cs), cs_oc(cs)->output);
co_skip(sc_oc(cs), sc_oc(cs)->output);
return;
close:
cs_shutw(cs);
cs_shutr(cs);
cs_ic(cs)->flags |= CF_READ_NULL;
sc_ic(cs)->flags |= CF_READ_NULL;
}
void __sink_forward_session_deinit(struct sink_forward_target *sft)

View File

@ -2054,7 +2054,7 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
if (trash == NULL)
goto error;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
goto error;
while (1) {
@ -2795,7 +2795,7 @@ static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx)
if (trash == NULL)
goto error;
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
goto error;
while (1) {

View File

@ -1079,7 +1079,7 @@ static int cli_io_handler_add_crtlist(struct appctx *appctx)
/* for each bind_conf which use the crt-list, a new ckch_inst must be
* created.
*/
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
goto error;
switch (ctx->state) {

View File

@ -312,7 +312,7 @@ int stats_putchk(struct channel *chn, struct htx *htx, struct buffer *chk)
static const char *stats_scope_ptr(struct appctx *appctx, struct stconn *cs)
{
struct show_stat_ctx *ctx = appctx->svcctx;
struct channel *req = cs_oc(cs);
struct channel *req = sc_oc(cs);
struct htx *htx = htxbuf(&req->buf);
struct htx_blk *blk;
struct ist uri;
@ -3019,7 +3019,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 channel *rep = cs_ic(cs);
struct channel *rep = sc_ic(cs);
struct server *sv, *svs; /* server and server-state, server-state=server or server->track */
struct listener *l;
@ -3679,7 +3679,7 @@ static int stats_dump_proxies(struct stconn *cs,
{
struct appctx *appctx = __cs_appctx(cs);
struct show_stat_ctx *ctx = appctx->svcctx;
struct channel *rep = cs_ic(cs);
struct channel *rep = sc_ic(cs);
struct proxy *px;
/* dump proxies */
@ -3727,7 +3727,7 @@ static int stats_dump_stat_to_buffer(struct stconn *cs, struct htx *htx,
{
struct appctx *appctx = __cs_appctx(cs);
struct show_stat_ctx *ctx = appctx->svcctx;
struct channel *rep = cs_ic(cs);
struct channel *rep = sc_ic(cs);
enum stats_domain domain = ctx->domain;
chunk_reset(&trash);
@ -4285,8 +4285,8 @@ 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 channel *req = cs_oc(cs);
struct channel *res = cs_ic(cs);
struct channel *req = sc_oc(cs);
struct channel *res = sc_ic(cs);
struct htx *req_htx, *res_htx;
/* only proxy stats are available via http */

View File

@ -4680,7 +4680,7 @@ static int cli_io_handler_table(struct appctx *appctx)
* data though.
*/
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
/* in case of abort, remove any refcount we might have set on an entry */
if (ctx->state == STATE_DUMP) {
stksess_kill_if_expired(ctx->t, ctx->entry, 1);

View File

@ -3536,7 +3536,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
goto done;
}
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
if (unlikely(sc_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
/* If we're forced to shut down, we might have to remove our
* reference to the last stream being dumped.
*/