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.
diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h
index 873ce2a..fd78002 100644
--- a/include/haproxy/channel.h
+++ b/include/haproxy/channel.h
@@ -64,22 +64,22 @@
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_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
diff --git a/src/http_act.c b/src/http_act.c
index f35fadf..8c53bee 100644
--- a/src/http_act.c
+++ b/src/http_act.c
@@ -718,7 +718,7 @@
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;
diff --git a/src/http_ana.c b/src/http_ana.c
index 31ba3cc..a1b6b1f 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -4140,7 +4140,7 @@
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) {
diff --git a/src/tcp_rules.c b/src/tcp_rules.c
index e4c7647..37d5bed 100644
--- a/src/tcp_rules.c
+++ b/src/tcp_rules.c
@@ -116,7 +116,7 @@
*/
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 @@
_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 @@
* - 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 @@
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 @@
_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);