]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: spoe: rename all occurrences of stconn "cs" to "sc"
authorWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 08:34:25 +0000 (10:34 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:35 +0000 (19:33 +0200)
Function arguments and local variables in the SPOE applet called "cs"
were renamed to "sc" to avoid future confusion.

src/flt_spoe.c

index dabe6938d54e3e76431c2e904fc3e3dbca0dbf21..9c92451660b3838e555d2279914c965ebcda4105 100644 (file)
@@ -1137,7 +1137,7 @@ spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen
 static int
 spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
 {
-       struct stconn *cs = appctx_cs(appctx);
+       struct stconn *sc = appctx_cs(appctx);
        int      ret;
        uint32_t netint;
 
@@ -1147,9 +1147,9 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
        memcpy(buf, (char *)&netint, 4);
        ret = applet_putblk(appctx, buf, framesz+4);
        if (ret <= 0) {
-               if ((ret == -3 && b_is_null(&sc_ic(cs)->buf)) || ret == -1) {
+               if ((ret == -3 && b_is_null(&sc_ic(sc)->buf)) || ret == -1) {
                        /* WT: is this still needed for the case ret==-3 ? */
-                       sc_need_room(cs);
+                       sc_need_room(sc);
                        return 1; /* retry */
                }
                SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_IO;
@@ -1164,18 +1164,18 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
 static int
 spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
 {
-       struct stconn *cs = appctx_cs(appctx);
+       struct stconn *sc = appctx_cs(appctx);
        int      ret;
        uint32_t netint;
 
-       ret = co_getblk(sc_oc(cs), (char *)&netint, 4, 0);
+       ret = co_getblk(sc_oc(sc), (char *)&netint, 4, 0);
        if (ret > 0) {
                framesz = ntohl(netint);
                if (framesz > SPOE_APPCTX(appctx)->max_frame_size) {
                        SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_TOO_BIG;
                        return -1;
                }
-               ret = co_getblk(sc_oc(cs), buf, framesz, 4);
+               ret = co_getblk(sc_oc(sc), buf, framesz, 4);
        }
        if (ret <= 0) {
                if (ret == 0) {
@@ -1266,7 +1266,7 @@ spoe_init_appctx(struct appctx *appctx)
 static void
 spoe_release_appctx(struct appctx *appctx)
 {
-       struct stconn  *cs          = appctx_cs(appctx);
+       struct stconn  *sc          = appctx_cs(appctx);
        struct spoe_appctx  *spoe_appctx = SPOE_APPCTX(appctx);
        struct spoe_agent   *agent;
        struct spoe_context *ctx, *back;
@@ -1301,9 +1301,9 @@ spoe_release_appctx(struct appctx *appctx)
                if (spoe_appctx->status_code == SPOE_FRM_ERR_NONE)
                        spoe_appctx->status_code = SPOE_FRM_ERR_IO;
 
-               sc_shutw(cs);
-               sc_shutr(cs);
-               sc_ic(cs)->flags |= CF_READ_NULL;
+               sc_shutw(sc);
+               sc_shutr(sc);
+               sc_ic(sc)->flags |= CF_READ_NULL;
        }
 
        /* Destroy the task attached to this applet */
@@ -1386,21 +1386,21 @@ spoe_release_appctx(struct appctx *appctx)
 static int
 spoe_handle_connect_appctx(struct appctx *appctx)
 {
-       struct stconn *cs    = appctx_cs(appctx);
+       struct stconn *sc    = appctx_cs(appctx);
        struct spoe_agent  *agent = SPOE_APPCTX(appctx)->agent;
        char *frame, *buf;
        int   ret;
 
-       if (sc_state_in(cs->state, SC_SB_CER|SC_SB_DIS|SC_SB_CLO)) {
+       if (sc_state_in(sc->state, SC_SB_CER|SC_SB_DIS|SC_SB_CLO)) {
                /* closed */
                SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_IO;
                goto exit;
        }
 
-       if (!sc_state_in(cs->state, SC_SB_RDY|SC_SB_EST)) {
+       if (!sc_state_in(sc->state, SC_SB_RDY|SC_SB_EST)) {
                /* not connected yet */
                applet_have_more_data(appctx);
-               task_wakeup(__sc_strm(cs)->task, TASK_WOKEN_MSG);
+               task_wakeup(__sc_strm(sc)->task, TASK_WOKEN_MSG);
                goto stop;
        }
 
@@ -1452,13 +1452,13 @@ spoe_handle_connect_appctx(struct appctx *appctx)
 static int
 spoe_handle_connecting_appctx(struct appctx *appctx)
 {
-       struct stconn *cs     = appctx_cs(appctx);
+       struct stconn *sc     = appctx_cs(appctx);
        struct spoe_agent  *agent  = SPOE_APPCTX(appctx)->agent;
        char  *frame;
        int    ret;
 
 
-       if (cs->state == SC_ST_CLO || sc_opposite(cs)->state == SC_ST_CLO) {
+       if (sc->state == SC_ST_CLO || sc_opposite(sc)->state == SC_ST_CLO) {
                SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_IO;
                goto exit;
        }
@@ -1507,7 +1507,7 @@ spoe_handle_connecting_appctx(struct appctx *appctx)
   next:
        /* Do not forget to remove processed frame from the output buffer */
        if (trash.data)
-               co_skip(sc_oc(cs), trash.data);
+               co_skip(sc_oc(sc), trash.data);
 
        SPOE_APPCTX(appctx)->task->expire =
                tick_add_ifset(now_ms, agent->timeout.idle);
@@ -1705,12 +1705,12 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip)
 static int
 spoe_handle_processing_appctx(struct appctx *appctx)
 {
-       struct stconn      *cs    = appctx_cs(appctx);
-       struct server           *srv   = objt_server(__sc_strm(cs)->target);
+       struct stconn      *sc    = appctx_cs(appctx);
+       struct server           *srv   = objt_server(__sc_strm(sc)->target);
        struct spoe_agent       *agent = SPOE_APPCTX(appctx)->agent;
        int ret, skip_sending = 0, skip_receiving = 0, active_s = 0, active_r = 0, close_asap = 0;
 
-       if (cs->state == SC_ST_CLO || sc_opposite(cs)->state == SC_ST_CLO) {
+       if (sc->state == SC_ST_CLO || sc_opposite(sc)->state == SC_ST_CLO) {
                SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_IO;
                goto exit;
        }
@@ -1828,12 +1828,12 @@ spoe_handle_processing_appctx(struct appctx *appctx)
 static int
 spoe_handle_disconnect_appctx(struct appctx *appctx)
 {
-       struct stconn *cs    = appctx_cs(appctx);
+       struct stconn *sc    = appctx_cs(appctx);
        struct spoe_agent  *agent = SPOE_APPCTX(appctx)->agent;
        char *frame, *buf;
        int   ret;
 
-       if (cs->state == SC_ST_CLO || sc_opposite(cs)->state == SC_ST_CLO)
+       if (sc->state == SC_ST_CLO || sc_opposite(sc)->state == SC_ST_CLO)
                goto exit;
 
        if (appctx->st1 == SPOE_APPCTX_ERR_TOUT)
@@ -1881,11 +1881,11 @@ spoe_handle_disconnect_appctx(struct appctx *appctx)
 static int
 spoe_handle_disconnecting_appctx(struct appctx *appctx)
 {
-       struct stconn *cs = appctx_cs(appctx);
+       struct stconn *sc = appctx_cs(appctx);
        char  *frame;
        int    ret;
 
-       if (cs->state == SC_ST_CLO || sc_opposite(cs)->state == SC_ST_CLO) {
+       if (sc->state == SC_ST_CLO || sc_opposite(sc)->state == SC_ST_CLO) {
                SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_IO;
                goto exit;
        }
@@ -1932,7 +1932,7 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx)
   next:
        /* Do not forget to remove processed frame from the output buffer */
        if (trash.data)
-               co_skip(sc_oc(cs), trash.data);
+               co_skip(sc_oc(sc), trash.data);
 
        return 0;
   stop:
@@ -1946,7 +1946,7 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx)
 static void
 spoe_handle_appctx(struct appctx *appctx)
 {
-       struct stconn *cs = appctx_cs(appctx);
+       struct stconn *sc = appctx_cs(appctx);
        struct spoe_agent  *agent;
 
        if (SPOE_APPCTX(appctx) == NULL)
@@ -2007,9 +2007,9 @@ spoe_handle_appctx(struct appctx *appctx)
                        appctx->st0 = SPOE_APPCTX_ST_END;
                        SPOE_APPCTX(appctx)->task->expire = TICK_ETERNITY;
 
-                       sc_shutw(cs);
-                       sc_shutr(cs);
-                       sc_ic(cs)->flags |= CF_READ_NULL;
+                       sc_shutw(sc);
+                       sc_shutr(sc);
+                       sc_ic(sc)->flags |= CF_READ_NULL;
                        /* fall through */
 
                case SPOE_APPCTX_ST_END: