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.
This commit is contained in:
Christopher Faulet 2023-04-13 15:40:10 +02:00
parent 573ead1e68
commit 12762f09a5
6 changed files with 17 additions and 17 deletions

View File

@ -548,12 +548,6 @@ static inline void channel_htx_erase(struct channel *chn, struct htx *htx)
channel_erase(chn); 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 */ /* marks the channel as "shutdown" ASAP for writes */
static inline void channel_shutw_now(struct channel *chn) static inline void channel_shutw_now(struct channel *chn)
{ {

View File

@ -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 */ #endif /* _HAPROXY_SC_STRM_H */

View File

@ -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 */ return argl; /* return the number of elements in the array */
} else if (strcmp("quit", args[0]) == 0) { } else if (strcmp("quit", args[0]) == 0) {
channel_shutr_now(&s->req); sc_schedule_abort(s->scf);
channel_shutw_now(&s->res); channel_shutw_now(&s->res);
return argl; /* return the number of elements in the array */ return argl; /* return the number of elements in the array */
} else if (strcmp(args[0], "operator") == 0) { } else if (strcmp(args[0], "operator") == 0) {

View File

@ -8162,7 +8162,7 @@ __LJMP static int hlua_txn_done(lua_State *L)
channel_auto_read(res); channel_auto_read(res);
channel_auto_close(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); finst = ((htxn->dir == SMP_OPT_DIR_REQ) ? SF_FINST_R : SF_FINST_D);
goto done; goto done;

View File

@ -4273,7 +4273,7 @@ static void http_end_request(struct stream *s)
goto check_channel_flags; goto check_channel_flags;
if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW))) { 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); channel_shutw_now(chn);
} }
} }
@ -4372,7 +4372,7 @@ static void http_end_response(struct stream *s)
* transaction, so we can close it. * transaction, so we can close it.
*/ */
if (!(chn_cons(chn)->flags & (SC_FL_SHUTW|SC_FL_SHUTW_NOW))) { 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); channel_shutw_now(chn);
} }
} }
@ -4449,7 +4449,7 @@ int http_forward_proxy_resp(struct stream *s, int final)
channel_auto_read(res); channel_auto_read(res);
channel_auto_close(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 */ s->scb->flags |= SC_FL_EOI; /* The response is terminated, add EOI */
htxbuf(&res->buf)->flags |= HTX_FL_EOM; /* no more data are expected */ htxbuf(&res->buf)->flags |= HTX_FL_EOM; /* no more data are expected */
} }
@ -4512,7 +4512,7 @@ void http_reply_and_close(struct stream *s, short status, struct http_reply *msg
channel_htx_erase(&s->req, htxbuf(&s->req.buf)); channel_htx_erase(&s->req, htxbuf(&s->req.buf));
channel_auto_read(&s->res); channel_auto_read(&s->res);
channel_auto_close(&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) struct http_reply *http_error_message(struct stream *s)

View File

@ -861,7 +861,7 @@ void stream_retnclose(struct stream *s, const struct buffer *msg)
channel_auto_read(oc); channel_auto_read(oc);
channel_auto_close(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) 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 { else {
s->scb->state = SC_ST_CLO; /* shutw+ini = abort */ s->scb->state = SC_ST_CLO; /* shutw+ini = abort */
channel_shutw_now(req); /* fix buffer flags upon 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 */ /* 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))) && if (unlikely((scb->flags & SC_FL_SHUTW) && !(scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED))) &&
!req->analysers) !req->analysers)
channel_shutr_now(req); sc_schedule_abort(scf);
/* shutdown(read) pending */ /* shutdown(read) pending */
if (unlikely((scf->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) == SC_FL_ABRT_WANTED)) { 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 */ /* 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))) && if (unlikely((scf->flags & SC_FL_SHUTW) && !(scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED))) &&
!res->analysers) !res->analysers)
channel_shutr_now(res); sc_schedule_abort(scb);
/* shutdown(read) pending */ /* shutdown(read) pending */
if (unlikely((scb->flags & (SC_FL_SHUTR|SC_FL_ABRT_WANTED)) == SC_FL_ABRT_WANTED)) { 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; return;
channel_shutw_now(&stream->req); channel_shutw_now(&stream->req);
channel_shutr_now(&stream->res); sc_schedule_abort(stream->scb);
stream->task->nice = 1024; stream->task->nice = 1024;
if (!(stream->flags & SF_ERR_MASK)) if (!(stream->flags & SF_ERR_MASK))
stream->flags |= why; stream->flags |= why;