From: Christopher Faulet Date: Thu, 13 Apr 2023 13:40:10 +0000 (+0200) Subject: MINOR: channel/stconn: Replace channel_shutr_now() by sc_schedule_abort() X-Git-Tag: v2.8-dev8~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12762f09a5dfa0cdcb6661c56c845ed76f3b3d2c;p=thirdparty%2Fhaproxy.git MINOR: channel/stconn: Replace channel_shutr_now() by sc_schedule_abort() After the flag renaming, it is now the turn for the channel function to be renamed and moved in the SC scope. channel_shutr_now() is replaced by sc_schedule_abort(). The request channel is replaced by the front SC and the response is replace by the back SC. --- diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h index 4b93016594..50f0b754b5 100644 --- a/include/haproxy/channel.h +++ b/include/haproxy/channel.h @@ -548,12 +548,6 @@ static inline void channel_htx_erase(struct channel *chn, struct htx *htx) channel_erase(chn); } -/* marks the channel as "shutdown" ASAP for reads */ -static inline void channel_shutr_now(struct channel *chn) -{ - chn_prod(chn)->flags |= SC_FL_ABRT_WANTED; -} - /* marks the channel as "shutdown" ASAP for writes */ static inline void channel_shutw_now(struct channel *chn) { diff --git a/include/haproxy/sc_strm.h b/include/haproxy/sc_strm.h index 1161f53981..ae5861dc19 100644 --- a/include/haproxy/sc_strm.h +++ b/include/haproxy/sc_strm.h @@ -414,4 +414,10 @@ static inline void sc_set_hcto(struct stconn *sc) } +/* Schedule an abort for the SC */ +static inline void sc_schedule_abort(struct stconn *sc) +{ + sc->flags |= SC_FL_ABRT_WANTED; +} + #endif /* _HAPROXY_SC_STRM_H */ diff --git a/src/cli.c b/src/cli.c index 0de6203512..f3562ae317 100644 --- a/src/cli.c +++ b/src/cli.c @@ -2360,7 +2360,7 @@ int pcli_find_and_exec_kw(struct stream *s, char **args, int argl, char **errmsg return argl; /* return the number of elements in the array */ } else if (strcmp("quit", args[0]) == 0) { - channel_shutr_now(&s->req); + sc_schedule_abort(s->scf); channel_shutw_now(&s->res); return argl; /* return the number of elements in the array */ } else if (strcmp(args[0], "operator") == 0) { diff --git a/src/hlua.c b/src/hlua.c index 913b237c90..a00a114165 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -8162,7 +8162,7 @@ __LJMP static int hlua_txn_done(lua_State *L) channel_auto_read(res); channel_auto_close(res); - channel_shutr_now(res); + sc_schedule_abort(s->scb); finst = ((htxn->dir == SMP_OPT_DIR_REQ) ? SF_FINST_R : SF_FINST_D); goto done; diff --git a/src/http_ana.c b/src/http_ana.c index 3ae76ed0dc..1ad56e471d 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -4273,7 +4273,7 @@ static void http_end_request(struct stream *s) goto check_channel_flags; if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW))) { - channel_shutr_now(chn); + sc_schedule_abort(s->scf); channel_shutw_now(chn); } } @@ -4372,7 +4372,7 @@ static void http_end_response(struct stream *s) * transaction, so we can close it. */ if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW))) { - channel_shutr_now(chn); + sc_schedule_abort(s->scb); channel_shutw_now(chn); } } @@ -4449,7 +4449,7 @@ int http_forward_proxy_resp(struct stream *s, int final) channel_auto_read(res); channel_auto_close(res); - channel_shutr_now(res); + sc_schedule_abort(s->scb); s->scb->flags |= SC_FL_EOI; /* The response is terminated, add EOI */ htxbuf(&res->buf)->flags |= HTX_FL_EOM; /* no more data are expected */ } @@ -4512,7 +4512,7 @@ end: channel_htx_erase(&s->req, htxbuf(&s->req.buf)); channel_auto_read(&s->res); channel_auto_close(&s->res); - channel_shutr_now(&s->res); + sc_schedule_abort(s->scb); } struct http_reply *http_error_message(struct stream *s) diff --git a/src/stream.c b/src/stream.c index cef544f12b..f1b4c5bf81 100644 --- a/src/stream.c +++ b/src/stream.c @@ -861,7 +861,7 @@ void stream_retnclose(struct stream *s, const struct buffer *msg) channel_auto_read(oc); channel_auto_close(oc); - channel_shutr_now(oc); + sc_schedule_abort(s->scb); } int stream_set_timeout(struct stream *s, enum act_timeout_name name, int timeout) @@ -2309,7 +2309,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) else { s->scb->state = SC_ST_CLO; /* shutw+ini = abort */ channel_shutw_now(req); /* fix buffer flags upon abort */ - channel_shutr_now(res); + sc_schedule_abort(scb); } } @@ -2381,7 +2381,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) /* shutdown(write) done on server side, we must stop the client too */ if (unlikely((scb->flags & SC_FL_SHUTW) && !(scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED))) && !req->analysers) - channel_shutr_now(req); + sc_schedule_abort(scf); /* shutdown(read) pending */ if (unlikely((scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) == SC_FL_ABRT_WANTED)) { @@ -2501,7 +2501,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) /* shutdown(write) done on the client side, we must stop the server too */ if (unlikely((scf->flags & SC_FL_SHUTW) && !(scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED))) && !res->analysers) - channel_shutr_now(res); + sc_schedule_abort(scb); /* shutdown(read) pending */ if (unlikely((scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) == SC_FL_ABRT_WANTED)) { @@ -2782,7 +2782,7 @@ void stream_shutdown(struct stream *stream, int why) return; channel_shutw_now(&stream->req); - channel_shutr_now(&stream->res); + sc_schedule_abort(stream->scb); stream->task->nice = 1024; if (!(stream->flags & SF_ERR_MASK)) stream->flags |= why;