mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 06:11:32 +01:00
MINOR: tree-wide: Replace several chn_cons() by the corresponding SC
At many places, call to chn_cons() can be easily replaced by the corresponding SC. It is a bit easier to understand which side is manipulated.
This commit is contained in:
parent
b2b1c3a6ea
commit
64350bbf05
@ -1956,7 +1956,7 @@ int srv_redispatch_connect(struct stream *s)
|
||||
static int back_may_abort_req(struct channel *req, struct stream *s)
|
||||
{
|
||||
return (sc_ep_test(s->scf, SE_FL_ERROR) ||
|
||||
((chn_cons(req)->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUT_DONE)) && /* empty and client aborted */
|
||||
((s->scb->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUT_DONE)) && /* empty and client aborted */
|
||||
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE))));
|
||||
}
|
||||
|
||||
@ -2241,13 +2241,12 @@ void back_handle_st_con(struct stream *s)
|
||||
{
|
||||
struct stconn *sc = s->scb;
|
||||
struct channel *req = &s->req;
|
||||
struct channel *rep = &s->res;
|
||||
|
||||
DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s);
|
||||
|
||||
/* the client might want to abort */
|
||||
if ((chn_cons(rep)->flags & SC_FL_SHUT_DONE) ||
|
||||
((chn_cons(req)->flags & SC_FL_SHUT_WANTED) &&
|
||||
if ((s->scf->flags & SC_FL_SHUT_DONE) ||
|
||||
((s->scb->flags & SC_FL_SHUT_WANTED) &&
|
||||
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
|
||||
sc->flags |= SC_FL_NOLINGER;
|
||||
sc_shutdown(sc);
|
||||
@ -2434,7 +2433,6 @@ void back_handle_st_rdy(struct stream *s)
|
||||
{
|
||||
struct stconn *sc = s->scb;
|
||||
struct channel *req = &s->req;
|
||||
struct channel *rep = &s->res;
|
||||
|
||||
DBG_TRACE_ENTER(STRM_EV_STRM_PROC|STRM_EV_CS_ST, s);
|
||||
|
||||
@ -2470,8 +2468,8 @@ void back_handle_st_rdy(struct stream *s)
|
||||
*/
|
||||
if (!(req->flags & CF_WROTE_DATA)) {
|
||||
/* client abort ? */
|
||||
if ((chn_cons(rep)->flags & SC_FL_SHUT_DONE) ||
|
||||
((chn_cons(req)->flags & SC_FL_SHUT_WANTED) &&
|
||||
if ((s->scf->flags & SC_FL_SHUT_DONE) ||
|
||||
((s->scb->flags & SC_FL_SHUT_WANTED) &&
|
||||
(channel_is_empty(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
|
||||
/* give up */
|
||||
sc->flags |= SC_FL_NOLINGER;
|
||||
|
||||
@ -2716,7 +2716,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
struct proxy *be = s->be;
|
||||
|
||||
if (sc_ep_test(s->scb, SE_FL_ERR_PENDING|SE_FL_ERROR) || (rep->flags & (CF_READ_TIMEOUT|CF_WRITE_TIMEOUT)) ||
|
||||
((chn_cons(rep)->flags & SC_FL_SHUT_DONE) && (rep->to_forward || co_data(rep)))) {
|
||||
((s->scf->flags & SC_FL_SHUT_DONE) && (rep->to_forward || co_data(rep)))) {
|
||||
pcli_reply_and_close(s, "Can't connect to the target CLI!\n");
|
||||
s->req.analysers &= ~AN_REQ_WAIT_CLI;
|
||||
s->res.analysers &= ~AN_RES_WAIT_CLI;
|
||||
|
||||
@ -983,7 +983,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
|
||||
if (!(txn->flags & TX_CON_WANT_TUN))
|
||||
channel_dont_close(req);
|
||||
|
||||
if ((chn_cons(req)->flags & SC_FL_SHUT_DONE) && co_data(req)) {
|
||||
if ((s->scb->flags & SC_FL_SHUT_DONE) && co_data(req)) {
|
||||
/* request errors are most likely due to the server aborting the
|
||||
* transfer. */
|
||||
goto return_srv_abort;
|
||||
@ -1023,7 +1023,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
|
||||
|
||||
waiting:
|
||||
/* waiting for the last bits to leave the buffer */
|
||||
if (chn_cons(req)->flags & SC_FL_SHUT_DONE)
|
||||
if (s->scb->flags & SC_FL_SHUT_DONE)
|
||||
goto return_srv_abort;
|
||||
|
||||
/* When TE: chunked is used, we need to get there again to parse remaining
|
||||
@ -1296,7 +1296,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
||||
/* 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) &&
|
||||
(chn_cons(&s->req)->flags & SC_FL_SHUT_DONE)) {
|
||||
(s->scb->flags & SC_FL_SHUT_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)
|
||||
@ -2104,7 +2104,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
||||
|
||||
channel_dont_close(res);
|
||||
|
||||
if ((chn_cons(res)->flags & SC_FL_SHUT_DONE) && co_data(res)) {
|
||||
if ((s->scf->flags & SC_FL_SHUT_DONE) && co_data(res)) {
|
||||
/* response errors are most likely due to the client aborting
|
||||
* the transfer. */
|
||||
goto return_cli_abort;
|
||||
@ -2120,7 +2120,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
||||
return 0;
|
||||
|
||||
missing_data_or_waiting:
|
||||
if (chn_cons(res)->flags & SC_FL_SHUT_DONE)
|
||||
if (s->scf->flags & SC_FL_SHUT_DONE)
|
||||
goto return_cli_abort;
|
||||
|
||||
/* stop waiting for data if the input is closed before the end. If the
|
||||
@ -2130,7 +2130,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
||||
*/
|
||||
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) &&
|
||||
(chn_cons(&s->req)->flags & SC_FL_SHUT_DONE))
|
||||
(s->scb->flags & SC_FL_SHUT_DONE))
|
||||
goto return_cli_abort;
|
||||
/* If we have some pending data, we continue the processing */
|
||||
if (htx_is_empty(htx))
|
||||
@ -4272,7 +4272,7 @@ static void http_end_request(struct stream *s)
|
||||
txn->rsp.msg_state != HTTP_MSG_CLOSED)
|
||||
goto check_channel_flags;
|
||||
|
||||
if (!(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
|
||||
if (!(s->scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
|
||||
sc_schedule_abort(s->scf);
|
||||
sc_schedule_shutdown(s->scb);
|
||||
}
|
||||
@ -4306,7 +4306,7 @@ static void http_end_request(struct stream *s)
|
||||
|
||||
check_channel_flags:
|
||||
/* Here, we are in HTTP_MSG_DONE or HTTP_MSG_TUNNEL */
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) {
|
||||
if (s->scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) {
|
||||
/* if we've just closed an output, let's switch */
|
||||
txn->req.msg_state = HTTP_MSG_CLOSING;
|
||||
goto http_msg_closing;
|
||||
@ -4371,7 +4371,7 @@ static void http_end_response(struct stream *s)
|
||||
/* we're not expecting any new data to come for this
|
||||
* transaction, so we can close it.
|
||||
*/
|
||||
if (!(chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
|
||||
if (!(s->scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
|
||||
sc_schedule_abort(s->scb);
|
||||
sc_schedule_shutdown(s->scf);
|
||||
}
|
||||
@ -4402,7 +4402,7 @@ static void http_end_response(struct stream *s)
|
||||
|
||||
check_channel_flags:
|
||||
/* Here, we are in HTTP_MSG_DONE or HTTP_MSG_TUNNEL */
|
||||
if (chn_cons(chn)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) {
|
||||
if (s->scf->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) {
|
||||
/* if we've just closed an output, let's switch */
|
||||
txn->rsp.msg_state = HTTP_MSG_CLOSING;
|
||||
goto http_msg_closing;
|
||||
|
||||
@ -1369,7 +1369,7 @@ static int sc_conn_recv(struct stconn *sc)
|
||||
cur_read += ret;
|
||||
|
||||
/* if we're allowed to directly forward data, we must update ->o */
|
||||
if (ic->to_forward && !(chn_cons(ic)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
|
||||
if (ic->to_forward && !(sc_opposite(sc)->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED))) {
|
||||
unsigned long fwd = ret;
|
||||
if (ic->to_forward != CHN_INFINITE_FORWARD) {
|
||||
if (fwd > ic->to_forward)
|
||||
|
||||
@ -1956,7 +1956,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
if (((req->flags & ~rqf_last) & CF_MASK_ANALYSER) ||
|
||||
((scf->flags ^ scf_flags) & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) ||
|
||||
((scb->flags ^ scb_flags) & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) ||
|
||||
(req->analysers && (chn_cons(req)->flags & SC_FL_SHUT_DONE)) ||
|
||||
(req->analysers && (scb->flags & SC_FL_SHUT_DONE)) ||
|
||||
scf->state != rq_prod_last ||
|
||||
scb->state != rq_cons_last ||
|
||||
s->pending_events & TASK_WOKEN_MSG) {
|
||||
@ -2061,7 +2061,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
|
||||
if (((res->flags & ~rpf_last) & CF_MASK_ANALYSER) ||
|
||||
((scb->flags ^ scb_flags) & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) ||
|
||||
((scf->flags ^ scf_flags) & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) ||
|
||||
(res->analysers && (chn_cons(res)->flags & SC_FL_SHUT_DONE)) ||
|
||||
(res->analysers && (scf->flags & SC_FL_SHUT_DONE)) ||
|
||||
scf->state != rp_cons_last ||
|
||||
scb->state != rp_prod_last ||
|
||||
s->pending_events & TASK_WOKEN_MSG) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user