MINOR: channel/stconn: Replace sc_shutr() by sc_abort()
All reference to a shutr is replaced by an abort. So sc_shutr() is renamed
sc_abort(). SC app ops functions are renamed accordingly.
diff --git a/include/haproxy/sc_strm.h b/include/haproxy/sc_strm.h
index 357092b..a53b3d7 100644
--- a/include/haproxy/sc_strm.h
+++ b/include/haproxy/sc_strm.h
@@ -262,13 +262,6 @@
}
-/* Sends a shutr to the endpoint using the data layer */
-static inline void sc_shutr(struct stconn *sc)
-{
- if (likely(sc->app_ops->shutr))
- sc->app_ops->shutr(sc);
-}
-
/* Sends a shutw to the endpoint using the data layer */
static inline void sc_shutw(struct stconn *sc)
{
@@ -420,6 +413,13 @@
sc->flags |= SC_FL_ABRT_WANTED;
}
+/* Abort the SC and notify the endpoint using the data layer */
+static inline void sc_abort(struct stconn *sc)
+{
+ if (likely(sc->app_ops->abort))
+ sc->app_ops->abort(sc);
+}
+
/* Schedule a shutdown for the SC */
static inline void sc_schedule_shutdown(struct stconn *sc)
{
diff --git a/include/haproxy/stconn-t.h b/include/haproxy/stconn-t.h
index 5901ba2..1beac15 100644
--- a/include/haproxy/stconn-t.h
+++ b/include/haproxy/stconn-t.h
@@ -265,7 +265,7 @@
struct sc_app_ops {
void (*chk_rcv)(struct stconn *); /* chk_rcv function, may not be null */
void (*chk_snd)(struct stconn *); /* chk_snd function, may not be null */
- void (*shutr)(struct stconn *); /* shut read function, may not be null */
+ void (*abort)(struct stconn *); /* abort function, may not be null */
void (*shutw)(struct stconn *); /* shut write function, may not be null */
int (*wake)(struct stconn *); /* data-layer callback to report activity */
char name[8]; /* data layer name, zero-terminated */
diff --git a/src/backend.c b/src/backend.c
index 8b4e4fb..885cec4 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -2022,7 +2022,7 @@
process_srv_queue(srv);
/* Failed and not retryable. */
- sc_shutr(sc);
+ sc_abort(sc);
sc_shutw(sc);
sc_ep_set(sc, SE_FL_ERROR|SE_FL_EOS);
@@ -2082,7 +2082,7 @@
if (srv)
_HA_ATOMIC_INC(&srv->counters.failed_conns);
_HA_ATOMIC_INC(&s->be->be_counters.failed_conns);
- sc_shutr(sc);
+ sc_abort(sc);
sc_shutw(sc);
req->flags |= CF_WRITE_TIMEOUT;
if (!s->conn_err_type)
@@ -2142,7 +2142,7 @@
/* give up */
s->conn_exp = TICK_ETERNITY;
s->flags &= ~SF_CONN_EXP;
- sc_shutr(sc);
+ sc_abort(sc);
sc_shutw(sc);
sc->state = SC_ST_CLO;
if (s->srv_error)
@@ -2182,7 +2182,7 @@
*/
s->flags &= ~(SF_ERR_MASK | SF_FINST_MASK);
- sc_shutr(sc);
+ sc_abort(sc);
sc_shutw(sc);
sc_ep_set(sc, SE_FL_ERROR|SE_FL_EOS);
s->conn_err_type = STRM_ET_CONN_RES;
@@ -2208,7 +2208,7 @@
}
/* we did not get any server, let's check the cause */
- sc_shutr(sc);
+ sc_abort(sc);
sc_shutw(sc);
sc_ep_set(sc, SE_FL_ERROR|SE_FL_EOS);
if (!s->conn_err_type)
diff --git a/src/cli.c b/src/cli.c
index cd1e9a8..840f775 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -2747,7 +2747,7 @@
pcli_write_prompt(s);
s->scb->flags |= SC_FL_NOLINGER | SC_FL_NOHALF;
- sc_shutr(s->scb);
+ sc_abort(s->scb);
sc_shutw(s->scb);
/*
diff --git a/src/http_ana.c b/src/http_ana.c
index 7825e65..e17075c 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -4177,7 +4177,7 @@
goto fail;
/* return without error. */
- sc_shutr(sc);
+ sc_abort(sc);
sc_shutw(sc);
s->conn_err_type = STRM_ET_NONE;
sc->state = SC_ST_CLO;
diff --git a/src/stconn.c b/src/stconn.c
index aa9b2d5..64163d5 100644
--- a/src/stconn.c
+++ b/src/stconn.c
@@ -24,19 +24,19 @@
DECLARE_POOL(pool_head_sedesc, "sedesc", sizeof(struct sedesc));
/* functions used by default on a detached stream connector */
-static void sc_app_shutr(struct stconn *sc);
+static void sc_app_abort(struct stconn *sc);
static void sc_app_shutw(struct stconn *sc);
static void sc_app_chk_rcv(struct stconn *sc);
static void sc_app_chk_snd(struct stconn *sc);
/* functions used on a mux-based stream connector */
-static void sc_app_shutr_conn(struct stconn *sc);
+static void sc_app_abort_conn(struct stconn *sc);
static void sc_app_shutw_conn(struct stconn *sc);
static void sc_app_chk_rcv_conn(struct stconn *sc);
static void sc_app_chk_snd_conn(struct stconn *sc);
/* functions used on an applet-based stream connector */
-static void sc_app_shutr_applet(struct stconn *sc);
+static void sc_app_abort_applet(struct stconn *sc);
static void sc_app_shutw_applet(struct stconn *sc);
static void sc_app_chk_rcv_applet(struct stconn *sc);
static void sc_app_chk_snd_applet(struct stconn *sc);
@@ -50,7 +50,7 @@
struct sc_app_ops sc_app_conn_ops = {
.chk_rcv = sc_app_chk_rcv_conn,
.chk_snd = sc_app_chk_snd_conn,
- .shutr = sc_app_shutr_conn,
+ .abort = sc_app_abort_conn,
.shutw = sc_app_shutw_conn,
.wake = sc_conn_process,
.name = "STRM",
@@ -60,7 +60,7 @@
struct sc_app_ops sc_app_embedded_ops = {
.chk_rcv = sc_app_chk_rcv,
.chk_snd = sc_app_chk_snd,
- .shutr = sc_app_shutr,
+ .abort = sc_app_abort,
.shutw = sc_app_shutw,
.wake = NULL, /* may never be used */
.name = "NONE", /* may never be used */
@@ -70,7 +70,7 @@
struct sc_app_ops sc_app_applet_ops = {
.chk_rcv = sc_app_chk_rcv_applet,
.chk_snd = sc_app_chk_snd_applet,
- .shutr = sc_app_shutr_applet,
+ .abort = sc_app_abort_applet,
.shutw = sc_app_shutw_applet,
.wake = sc_applet_process,
.name = "STRM",
@@ -80,7 +80,7 @@
struct sc_app_ops sc_app_check_ops = {
.chk_rcv = NULL,
.chk_snd = NULL,
- .shutr = NULL,
+ .abort = NULL,
.shutw = NULL,
.wake = wake_srv_chk,
.name = "CHCK",
@@ -530,7 +530,7 @@
* reflect the new state. If the stream connector has SC_FL_NOHALF, we also
* forward the close to the write side. The owner task is woken up if it exists.
*/
-static void sc_app_shutr(struct stconn *sc)
+static void sc_app_abort(struct stconn *sc)
{
struct channel *ic = sc_ic(sc);
@@ -655,7 +655,7 @@
* descriptors are then shutdown or closed accordingly. The function
* automatically disables polling if needed.
*/
-static void sc_app_shutr_conn(struct stconn *sc)
+static void sc_app_abort_conn(struct stconn *sc)
{
struct channel *ic = sc_ic(sc);
@@ -738,7 +738,7 @@
__fallthrough;
case SC_ST_CON:
/* we may have to close a pending connection, and mark the
- * response buffer as shutr
+ * response buffer as abort
*/
sc_conn_shut(sc);
__fallthrough;
@@ -851,7 +851,7 @@
* we also forward the close to the write side. The owner task is woken up if
* it exists.
*/
-static void sc_app_shutr_applet(struct stconn *sc)
+static void sc_app_abort_applet(struct stconn *sc)
{
struct channel *ic = sc_ic(sc);
@@ -862,7 +862,7 @@
sc->flags |= SC_FL_ABRT_DONE;
ic->flags |= CF_READ_EVENT;
- /* Note: on shutr, we don't call the applet */
+ /* Note: on abort, we don't call the applet */
if (!sc_state_in(sc->state, SC_SB_CON|SC_SB_RDY|SC_SB_EST))
return;
@@ -1197,7 +1197,7 @@
if ((sc->wait_event.events & SUB_RETRY_RECV) || sc_waiting_room(sc))
return 0;
- /* maybe we were called immediately after an asynchronous shutr */
+ /* maybe we were called immediately after an asynchronous abort */
if (sc->flags & SC_FL_ABRT_DONE)
return 1;
@@ -1847,7 +1847,7 @@
if (sc_ep_test(sc, SE_FL_EOS)) {
/* we received a shutdown */
- sc_shutr(sc);
+ sc_abort(sc);
}
/* If the applet wants to write and the channel is closed, it's a
diff --git a/src/stream.c b/src/stream.c
index 8684000..f455b32 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1593,7 +1593,7 @@
if (unlikely(!(s->scf->flags & SC_FL_ABRT_DONE) && (s->req.flags & CF_READ_TIMEOUT))) {
if (s->scf->flags & SC_FL_NOHALF)
s->scf->flags |= SC_FL_NOLINGER;
- sc_shutr(s->scf);
+ sc_abort(s->scf);
}
if (unlikely(!(s->scf->flags & SC_FL_SHUTW) && (s->res.flags & CF_WRITE_TIMEOUT))) {
s->scf->flags |= SC_FL_NOLINGER;
@@ -1603,7 +1603,7 @@
if (unlikely(!(s->scb->flags & SC_FL_ABRT_DONE) && (s->res.flags & CF_READ_TIMEOUT))) {
if (s->scb->flags & SC_FL_NOHALF)
s->scb->flags |= SC_FL_NOLINGER;
- sc_shutr(s->scb);
+ sc_abort(s->scb);
}
if (HAS_FILTERS(s))
@@ -1826,7 +1826,7 @@
srv = objt_server(s->target);
if (unlikely(sc_ep_test(scf, SE_FL_ERROR))) {
if (sc_state_in(scf->state, SC_SB_EST|SC_SB_DIS)) {
- sc_shutr(scf);
+ sc_abort(scf);
sc_shutw(scf);
//sc_report_error(scf); TODO: Be sure it is useless
if (!(req->analysers) && !(res->analysers)) {
@@ -1846,7 +1846,7 @@
if (unlikely(sc_ep_test(scb, SE_FL_ERROR))) {
if (sc_state_in(scb->state, SC_SB_EST|SC_SB_DIS)) {
- sc_shutr(scb);
+ sc_abort(scb);
sc_shutw(scb);
//sc_report_error(scb); TODO: Be sure it is useless
_HA_ATOMIC_INC(&s->be->be_counters.failed_resp);
@@ -2387,7 +2387,7 @@
if (unlikely((scf->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) == SC_FL_ABRT_WANTED)) {
if (scf->flags & SC_FL_NOHALF)
scf->flags |= SC_FL_NOLINGER;
- sc_shutr(scf);
+ sc_abort(scf);
}
/* Benchmarks have shown that it's optimal to do a full resync now */
@@ -2507,7 +2507,7 @@
if (unlikely((scb->flags & (SC_FL_ABRT_DONE|SC_FL_ABRT_WANTED)) == SC_FL_ABRT_WANTED)) {
if (scb->flags & SC_FL_NOHALF)
scb->flags |= SC_FL_NOLINGER;
- sc_shutr(scb);
+ sc_abort(scb);
}
if (scf->state == SC_ST_DIS ||
diff --git a/src/tcp_rules.c b/src/tcp_rules.c
index 13dc562..01c0a2e 100644
--- a/src/tcp_rules.c
+++ b/src/tcp_rules.c
@@ -393,7 +393,7 @@
else if (rule->action == ACT_TCP_CLOSE) {
chn_prod(rep)->flags |= SC_FL_NOLINGER | SC_FL_NOHALF;
sc_must_kill_conn(chn_prod(rep));
- sc_shutr(chn_prod(rep));
+ sc_abort(chn_prod(rep));
sc_shutw(chn_prod(rep));
s->last_rule_file = rule->conf.file;
s->last_rule_line = rule->conf.line;