MINOR: stream: Introduce stream_abort() to abort on both sides in same time

The function stream_abort() should now be called when an abort is performed
on the both channels in same time.
This commit is contained in:
Christopher Faulet 2023-04-13 15:22:29 +02:00
parent 3db538ac2f
commit 7eb837df4a
6 changed files with 16 additions and 16 deletions

View File

@ -388,6 +388,7 @@ static inline int stream_check_conn_timeout(struct stream *s)
int stream_set_timeout(struct stream *s, enum act_timeout_name name, int timeout);
void stream_retnclose(struct stream *s, const struct buffer *msg);
void sess_set_term_flags(struct stream *s);
void stream_abort(struct stream *s);
void service_keywords_register(struct action_kw_list *kw_list);
struct action_kw *service_find(const char *kw);

View File

@ -720,8 +720,7 @@ static enum act_return http_action_reject(struct act_rule *rule, struct proxy *p
struct session *sess, struct stream *s, int flags)
{
sc_must_kill_conn(chn_prod(&s->req));
channel_abort(&s->req);
channel_abort(&s->res);
stream_abort(s);
s->req.analysers &= AN_REQ_FLT_END;
s->res.analysers &= AN_RES_FLT_END;

View File

@ -117,8 +117,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
if (chn_prod(req)->flags & SC_FL_SHUTR) {
s->logs.logwait = 0;
s->logs.level = 0;
channel_abort(&s->req);
channel_abort(&s->res);
stream_abort(s);
req->analysers &= AN_REQ_FLT_END;
req->analyse_exp = TICK_ETERNITY;
DBG_TRACE_LEAVE(STRM_EV_STRM_ANA, s);

View File

@ -830,6 +830,13 @@ void stream_process_counters(struct stream *s)
}
}
/* Abort processing on the both channels in same time */
void stream_abort(struct stream *s)
{
channel_abort(&s->req);
channel_abort(&s->res);
}
/*
* Returns a message to the client ; the connection is shut down for read,
* and the request is cleared so that no server connection can be initiated.
@ -1143,8 +1150,7 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
sw_failed:
/* immediately abort this request in case of allocation failure */
channel_abort(&s->req);
channel_abort(&s->res);
stream_abort(s);
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_RESOURCE;
@ -1515,8 +1521,7 @@ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_prot
*/
s->logs.logwait = 0;
s->logs.level = 0;
channel_abort(&s->req);
channel_abort(&s->res);
stream_abort(s);
s->req.analysers &= AN_REQ_FLT_END;
s->req.analyse_exp = TICK_ETERNITY;
}
@ -3030,8 +3035,7 @@ static enum act_return tcp_action_switch_stream_mode(struct act_rule *rule, stru
if (!IS_HTX_STRM(s) && mode == PR_MODE_HTTP) {
if (!stream_set_http_mode(s, mux_proto)) {
channel_abort(&s->req);
channel_abort(&s->res);
stream_abort(s);
return ACT_RET_ABRT;
}
}

View File

@ -337,8 +337,7 @@ static enum act_return tcp_exec_action_silent_drop(struct act_rule *rule, struct
out:
/* kill the stream if any */
if (strm) {
channel_abort(&strm->req);
channel_abort(&strm->res);
stream_abort(strm);
strm->req.analysers &= AN_REQ_FLT_END;
strm->res.analysers &= AN_RES_FLT_END;
if (strm->flags & SF_BE_ASSIGNED)

View File

@ -255,8 +255,7 @@ resume_execution:
reject:
sc_must_kill_conn(chn_prod(req));
channel_abort(req);
channel_abort(&s->res);
stream_abort(s);
abort:
req->analysers &= AN_REQ_FLT_END;
@ -453,8 +452,7 @@ resume_execution:
reject:
sc_must_kill_conn(chn_prod(rep));
channel_abort(rep);
channel_abort(&s->req);
stream_abort(s);
abort:
rep->analysers &= AN_RES_FLT_END;