MINOR: channel: Use conn-streams as channel producer and consumer

chn_prod() and chn_cons() now return a conn-stream instead of a
stream-interface.
This commit is contained in:
Christopher Faulet 2022-03-30 14:37:49 +02:00
parent 6cd56d5a69
commit 7b5ca8f457
4 changed files with 19 additions and 19 deletions

View File

@ -64,22 +64,22 @@ static inline struct stream *chn_strm(const struct channel *chn)
return LIST_ELEM(chn, struct stream *, req);
}
/* returns a pointer to the stream interface feeding the channel (producer) */
static inline struct stream_interface *chn_prod(const struct channel *chn)
/* returns a pointer to the conn-stream feeding the channel (producer) */
static inline struct conn_stream *chn_prod(const struct channel *chn)
{
if (chn->flags & CF_ISRESP)
return LIST_ELEM(chn, struct stream *, res)->csb->si;
return LIST_ELEM(chn, struct stream *, res)->csb;
else
return LIST_ELEM(chn, struct stream *, req)->csf->si;
return LIST_ELEM(chn, struct stream *, req)->csf;
}
/* returns a pointer to the stream interface consuming the channel (producer) */
static inline struct stream_interface *chn_cons(const struct channel *chn)
/* returns a pointer to the conn-stream consuming the channel (producer) */
static inline struct conn_stream *chn_cons(const struct channel *chn)
{
if (chn->flags & CF_ISRESP)
return LIST_ELEM(chn, struct stream *, res)->csf->si;
return LIST_ELEM(chn, struct stream *, res)->csf;
else
return LIST_ELEM(chn, struct stream *, req)->csb->si;
return LIST_ELEM(chn, struct stream *, req)->csb;
}
/* c_orig() : returns the pointer to the channel buffer's origin */
@ -433,7 +433,7 @@ static inline int channel_is_rewritable(const struct channel *chn)
*/
static inline int channel_may_send(const struct channel *chn)
{
return chn_cons(chn)->state == SI_ST_EST;
return chn_cons(chn)->si->state == SI_ST_EST;
}
/* HTX version of channel_may_recv(). Returns non-zero if the channel can still

View File

@ -718,7 +718,7 @@ static enum act_parse_ret parse_http_set_status(const char **args, int *orig_arg
static enum act_return http_action_reject(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s, int flags)
{
si_must_kill_conn(chn_prod(&s->req));
si_must_kill_conn(chn_prod(&s->req)->si);
channel_abort(&s->req);
channel_abort(&s->res);
s->req.analysers &= AN_REQ_FLT_END;

View File

@ -4140,7 +4140,7 @@ enum rule_result http_wait_for_msg_body(struct stream *s, struct channel *chn,
if ((htx->flags & HTX_FL_EOM) ||
htx_get_tail_type(htx) > HTX_BLK_DATA ||
channel_htx_full(chn, htx, global.tune.maxrewrite) ||
si_rx_blocked_room(chn_prod(chn)))
si_rx_blocked_room(chn_prod(chn)->si))
goto end;
if (bytes) {

View File

@ -116,7 +116,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
*/
if ((req->flags & (CF_EOI|CF_SHUTR|CF_READ_ERROR)) || channel_full(req, global.tune.maxrewrite) ||
si_rx_blocked_room(chn_prod(req)) ||
si_rx_blocked_room(chn_prod(req)->si) ||
!s->be->tcp_req.inspect_delay || tick_is_expired(s->rules_exp, now_ms))
partial = SMP_OPT_FINAL;
else
@ -253,7 +253,7 @@ resume_execution:
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
reject:
si_must_kill_conn(chn_prod(req));
si_must_kill_conn(chn_prod(req)->si);
channel_abort(req);
channel_abort(&s->res);
@ -299,7 +299,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
* - if one rule returns KO, then return KO
*/
if ((rep->flags & (CF_EOI|CF_SHUTR|CF_READ_ERROR)) || channel_full(rep, global.tune.maxrewrite) ||
si_rx_blocked_room(chn_prod(rep)) ||
si_rx_blocked_room(chn_prod(rep)->si) ||
!s->be->tcp_rep.inspect_delay || tick_is_expired(s->rules_exp, now_ms))
partial = SMP_OPT_FINAL;
else
@ -390,10 +390,10 @@ resume_execution:
goto deny;
}
else if (rule->action == ACT_TCP_CLOSE) {
chn_prod(rep)->flags |= SI_FL_NOLINGER | SI_FL_NOHALF;
si_must_kill_conn(chn_prod(rep));
si_shutr(chn_prod(rep));
si_shutw(chn_prod(rep));
chn_prod(rep)->si->flags |= SI_FL_NOLINGER | SI_FL_NOHALF;
si_must_kill_conn(chn_prod(rep)->si);
si_shutr(chn_prod(rep)->si);
si_shutw(chn_prod(rep)->si);
s->last_rule_file = rule->conf.file;
s->last_rule_line = rule->conf.line;
goto end;
@ -450,7 +450,7 @@ resume_execution:
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp);
reject:
si_must_kill_conn(chn_prod(rep));
si_must_kill_conn(chn_prod(rep)->si);
channel_abort(rep);
channel_abort(&s->req);