MINOR: tree-wide: Replace several chn_prod() by the corresponding SC
At many places, call to chn_prod() can be easily replaced by the
corresponding SC. It is a bit easier to understand which side is
manipulated.
diff --git a/src/cli.c b/src/cli.c
index 5ac4935..1dc160d 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -2692,7 +2692,7 @@
goto read_again;
missing_data:
- if (chn_prod(req)->flags & SC_FL_ABRT_DONE) {
+ if (s->scf->flags & SC_FL_ABRT_DONE) {
/* There is no more request or a only a partial one and we
* receive a close from the client, we can leave */
sc_schedule_shutdown(s->scf);
@@ -2741,7 +2741,7 @@
return 0;
}
- if (chn_prod(rep)->flags & SC_FL_ABRT_DONE) {
+ if (s->scb->flags & SC_FL_ABRT_DONE) {
/* stream cleanup */
pcli_write_prompt(s);
diff --git a/src/http_act.c b/src/http_act.c
index c80bc51..596e68c 100644
--- a/src/http_act.c
+++ b/src/http_act.c
@@ -719,7 +719,7 @@
static enum act_return http_action_reject(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s, int flags)
{
- sc_must_kill_conn(chn_prod(&s->req));
+ sc_must_kill_conn(s->scf);
stream_abort(s);
s->req.analysers &= AN_REQ_FLT_END;
s->res.analysers &= AN_RES_FLT_END;
diff --git a/src/http_ana.c b/src/http_ana.c
index 3c46f2a..4ec3a38 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -114,7 +114,7 @@
/* An abort at this stage means we are performing a "destructive"
* HTTP upgrade (TCP>H2). In this case, we can leave.
*/
- if (chn_prod(req)->flags & SC_FL_ABRT_DONE) {
+ if (s->scf->flags & SC_FL_ABRT_DONE) {
s->logs.logwait = 0;
s->logs.level = 0;
stream_abort(s);
@@ -766,7 +766,7 @@
* there and that the timeout has not expired.
*/
channel_dont_connect(req);
- if (!(chn_prod(req)->flags & SC_FL_ABRT_DONE) &&
+ if (!(s->scf->flags & SC_FL_ABRT_DONE) &&
!tick_is_expired(req->analyse_exp, now_ms)) {
/* Be sure to drain all data from the request channel */
channel_htx_erase(req, htxbuf(&req->buf));
@@ -1002,7 +1002,7 @@
* it can be abused to exhaust source ports. */
if (s->be->options & PR_O_ABRT_CLOSE) {
channel_auto_read(req);
- if ((chn_prod(req)->flags & SC_FL_ABRT_DONE) && !(txn->flags & TX_CON_WANT_TUN))
+ if ((s->scf->flags & SC_FL_ABRT_DONE) && !(txn->flags & TX_CON_WANT_TUN))
s->scb->flags |= SC_FL_NOLINGER;
channel_auto_close(req);
}
@@ -1018,7 +1018,7 @@
missing_data_or_waiting:
/* stop waiting for data if the input is closed before the end */
- if (msg->msg_state < HTTP_MSG_ENDING && chn_prod(req)->flags & SC_FL_ABRT_DONE)
+ if (msg->msg_state < HTTP_MSG_ENDING && (s->scf->flags & SC_FL_ABRT_DONE))
goto return_cli_abort;
waiting:
@@ -1294,9 +1294,8 @@
}
/* 3: client abort with an abortonclose */
- else if ((chn_prod(rep)->flags & SC_FL_ABRT_DONE) &&
- (chn_prod(&s->req)->flags & SC_FL_ABRT_DONE) &&
- (s->scb->flags & SC_FL_SHUT_DONE)) {
+ else if ((s->scb->flags & (SC_FL_ABRT_DONE|SC_FL_SHUT_DONE)) == (SC_FL_ABRT_DONE|SC_FL_SHUT_DONE) &&
+ (s->scf->flags & SC_FL_ABRT_DONE)) {
_HA_ATOMIC_INC(&sess->fe->fe_counters.cli_aborts);
_HA_ATOMIC_INC(&s->be->be_counters.cli_aborts);
if (sess->listener && sess->listener->counters)
@@ -1318,7 +1317,7 @@
}
/* 4: close from server, capture the response if the server has started to respond */
- else if (chn_prod(rep)->flags & SC_FL_ABRT_DONE) {
+ else if (s->scb->flags & SC_FL_ABRT_DONE) {
if ((txn->flags & TX_L7_RETRY) &&
(s->be->retry_type & PR_RE_DISCONNECTED)) {
if (co_data(rep) || do_l7_retry(s, s->scb) == 0) {
@@ -2060,7 +2059,7 @@
if (htx->data != co_data(res))
goto missing_data_or_waiting;
- if (!(msg->flags & HTTP_MSGF_XFER_LEN) && (chn_prod(res)->flags & SC_FL_ABRT_DONE)) {
+ if (!(msg->flags & HTTP_MSGF_XFER_LEN) && (s->scb->flags & SC_FL_ABRT_DONE)) {
msg->msg_state = HTTP_MSG_ENDING;
goto ending;
}
@@ -2128,8 +2127,8 @@
* so we don't want to count this as a server abort. Otherwise it's a
* server abort.
*/
- if (msg->msg_state < HTTP_MSG_ENDING && (chn_prod(res)->flags & SC_FL_ABRT_DONE)) {
- if ((chn_prod(&s->req)->flags & SC_FL_ABRT_DONE) &&
+ if (msg->msg_state < HTTP_MSG_ENDING && (s->scb->flags & SC_FL_ABRT_DONE)) {
+ if ((s->scf->flags & SC_FL_ABRT_DONE) &&
(s->scb->flags & SC_FL_SHUT_DONE))
goto return_cli_abort;
/* If we have some pending data, we continue the processing */
@@ -2674,7 +2673,7 @@
/* Always call the action function if defined */
if (rule->action_ptr) {
if (sc_ep_test(s->scf, SE_FL_ERROR) ||
- ((chn_prod(&s->req)->flags & SC_FL_ABRT_DONE) &&
+ ((s->scf->flags & SC_FL_ABRT_DONE) &&
(px->options & PR_O_ABRT_CLOSE)))
act_opts |= ACT_OPT_FINAL;
@@ -2837,7 +2836,7 @@
/* Always call the action function if defined */
if (rule->action_ptr) {
if (sc_ep_test(s->scf, SE_FL_ERROR) ||
- ((chn_prod(&s->req)->flags & SC_FL_ABRT_DONE) &&
+ ((s->scf->flags & SC_FL_ABRT_DONE) &&
(px->options & PR_O_ABRT_CLOSE)))
act_opts |= ACT_OPT_FINAL;
diff --git a/src/stats.c b/src/stats.c
index 515c260..529f7e6 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -4493,7 +4493,7 @@
if (appctx->st0 == STAT_HTTP_POST) {
if (stats_process_http_post(sc))
appctx->st0 = STAT_HTTP_LAST;
- else if (chn_prod(req)->flags & SC_FL_ABRT_DONE)
+ else if (s->scf->flags & SC_FL_ABRT_DONE)
appctx->st0 = STAT_HTTP_DONE;
}
diff --git a/src/tcp_rules.c b/src/tcp_rules.c
index ad86ac8..d6ba9fb 100644
--- a/src/tcp_rules.c
+++ b/src/tcp_rules.c
@@ -117,7 +117,7 @@
*/
if ((s->scf->flags & (SC_FL_EOI|SC_FL_ABRT_DONE)) || channel_full(req, global.tune.maxrewrite) ||
- sc_waiting_room(chn_prod(req)) ||
+ sc_waiting_room(s->scf) ||
!s->be->tcp_req.inspect_delay || tick_is_expired(s->rules_exp, now_ms)) {
partial = SMP_OPT_FINAL;
/* Action may yield while the inspect_delay is not expired and there is no read error */
@@ -254,7 +254,7 @@
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
reject:
- sc_must_kill_conn(chn_prod(req));
+ sc_must_kill_conn(s->scf);
stream_abort(s);
abort:
@@ -299,7 +299,7 @@
* - if one rule returns KO, then return KO
*/
if ((s->scb->flags & (SC_FL_EOI|SC_FL_ABRT_DONE)) || channel_full(rep, global.tune.maxrewrite) ||
- sc_waiting_room(chn_prod(rep)) ||
+ sc_waiting_room(s->scb) ||
!s->be->tcp_rep.inspect_delay || tick_is_expired(s->rules_exp, now_ms)) {
partial = SMP_OPT_FINAL;
/* Action may yield while the inspect_delay is not expired and there is no read error */
@@ -391,10 +391,10 @@
goto deny;
}
else if (rule->action == ACT_TCP_CLOSE) {
- chn_prod(rep)->flags |= SC_FL_NOLINGER | SC_FL_NOHALF;
- sc_must_kill_conn(chn_prod(rep));
- sc_abort(chn_prod(rep));
- sc_shutdown(chn_prod(rep));
+ s->scb->flags |= SC_FL_NOLINGER | SC_FL_NOHALF;
+ sc_must_kill_conn(s->scb);
+ sc_abort(s->scb);
+ sc_shutdown(s->scb);
s->last_rule_file = rule->conf.file;
s->last_rule_line = rule->conf.line;
goto end;
@@ -451,7 +451,7 @@
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp);
reject:
- sc_must_kill_conn(chn_prod(rep));
+ sc_must_kill_conn(s->scb);
stream_abort(s);
abort: