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.
diff --git a/include/haproxy/stream.h b/include/haproxy/stream.h
index c400955..19ef92c 100644
--- a/include/haproxy/stream.h
+++ b/include/haproxy/stream.h
@@ -388,6 +388,7 @@
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);
diff --git a/src/http_act.c b/src/http_act.c
index 425b3ab..c80bc51 100644
--- a/src/http_act.c
+++ b/src/http_act.c
@@ -720,8 +720,7 @@
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;
diff --git a/src/http_ana.c b/src/http_ana.c
index 4dc1b52..39da847 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -117,8 +117,7 @@
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);
diff --git a/src/stream.c b/src/stream.c
index 5afef6c..e45b321 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -830,6 +830,13 @@
}
}
+/* 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 @@
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 @@
*/
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 @@
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;
}
}
diff --git a/src/tcp_act.c b/src/tcp_act.c
index 142e1ba..05ed056 100644
--- a/src/tcp_act.c
+++ b/src/tcp_act.c
@@ -337,8 +337,7 @@
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)
diff --git a/src/tcp_rules.c b/src/tcp_rules.c
index 10a45dd..8687df8 100644
--- a/src/tcp_rules.c
+++ b/src/tcp_rules.c
@@ -255,8 +255,7 @@
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 @@
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;