CLEANUP: peers: rename all occurrences of stconn "cs" to "sc"
In the applet, function arguments and local variables called "cs"
were renamed to "sc" to avoid future confusion.
diff --git a/src/peers.c b/src/peers.c
index 88c397c..6718034 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -1167,10 +1167,10 @@
*/
static inline int peer_getline(struct appctx *appctx)
{
- struct stconn *cs = appctx_cs(appctx);
+ struct stconn *sc = appctx_cs(appctx);
int n;
- n = co_getline(sc_oc(cs), trash.area, trash.size);
+ n = co_getline(sc_oc(sc), trash.area, trash.size);
if (!n)
return 0;
@@ -1184,7 +1184,7 @@
else
trash.area[n - 1] = 0;
- co_skip(sc_oc(cs), n);
+ co_skip(sc_oc(sc), n);
return n;
}
@@ -1201,7 +1201,7 @@
struct peer_prep_params *params)
{
int ret, msglen;
- struct stconn *cs = appctx_cs(appctx);
+ struct stconn *sc = appctx_cs(appctx);
msglen = peer_prepare_msg(trash.area, trash.size, params);
if (!msglen) {
@@ -1211,11 +1211,11 @@
}
/* message to buffer */
- ret = ci_putblk(sc_ic(cs), trash.area, msglen);
+ ret = ci_putblk(sc_ic(sc), trash.area, msglen);
if (ret <= 0) {
if (ret == -1) {
/* No more write possible */
- sc_need_room(cs);
+ sc_need_room(sc);
return -1;
}
appctx->st0 = PEER_SESS_ST_END;
@@ -1681,7 +1681,7 @@
static int peer_treat_updatemsg(struct appctx *appctx, struct peer *p, int updt, int exp,
char **msg_cur, char *msg_end, int msg_len, int totl)
{
- struct stconn *cs = appctx_cs(appctx);
+ struct stconn *sc = appctx_cs(appctx);
struct shared_table *st = p->remote_table;
struct stksess *ts, *newts;
uint32_t update;
@@ -2024,7 +2024,7 @@
ignore_msg:
/* skip consumed message */
- co_skip(sc_oc(cs), totl);
+ co_skip(sc_oc(sc), totl);
TRACE_DEVEL("leaving in error", PEERS_EV_UPDTMSG);
return 0;
@@ -2133,7 +2133,7 @@
static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p,
char **msg_cur, char *msg_end, int totl)
{
- struct stconn *cs = appctx_cs(appctx);
+ struct stconn *sc = appctx_cs(appctx);
int table_id_len;
struct shared_table *st;
int table_type;
@@ -2307,7 +2307,7 @@
return 1;
ignore_msg:
- co_skip(sc_oc(cs), totl);
+ co_skip(sc_oc(sc), totl);
return 0;
malformed_exit:
@@ -2332,10 +2332,10 @@
uint32_t *msg_len, int *totl)
{
int reql;
- struct stconn *cs = appctx_cs(appctx);
+ struct stconn *sc = appctx_cs(appctx);
char *cur;
- reql = co_getblk(sc_oc(cs), msg_head, 2 * sizeof(char), *totl);
+ reql = co_getblk(sc_oc(sc), msg_head, 2 * sizeof(char), *totl);
if (reql <= 0) /* closed or EOL not found */
goto incomplete;
@@ -2349,11 +2349,11 @@
/* Read and Decode message length */
msg_head += *totl;
msg_head_sz -= *totl;
- reql = co_data(sc_oc(cs)) - *totl;
+ reql = co_data(sc_oc(sc)) - *totl;
if (reql > msg_head_sz)
reql = msg_head_sz;
- reql = co_getblk(sc_oc(cs), msg_head, reql, *totl);
+ reql = co_getblk(sc_oc(sc), msg_head, reql, *totl);
if (reql <= 0) /* closed */
goto incomplete;
@@ -2379,7 +2379,7 @@
return -1;
}
- reql = co_getblk(sc_oc(cs), trash.area, *msg_len, *totl);
+ reql = co_getblk(sc_oc(sc), trash.area, *msg_len, *totl);
if (reql <= 0) /* closed */
goto incomplete;
*totl += reql;
@@ -2388,7 +2388,7 @@
return 1;
incomplete:
- if (reql < 0 || (sc_oc(cs)->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
+ if (reql < 0 || (sc_oc(sc)->flags & (CF_SHUTW|CF_SHUTW_NOW))) {
/* there was an error or the message was truncated */
appctx->st0 = PEER_SESS_ST_END;
return -1;
@@ -2850,8 +2850,8 @@
*/
static void peer_io_handler(struct appctx *appctx)
{
- struct stconn *cs = appctx_cs(appctx);
- struct stream *s = __sc_strm(cs);
+ struct stconn *sc = appctx_cs(appctx);
+ struct stream *s = __sc_strm(sc);
struct peers *curpeers = strm_fe(s)->parent;
struct peer *curpeer = NULL;
int reql = 0;
@@ -2860,8 +2860,8 @@
int prev_state;
/* Check if the input buffer is available. */
- if (sc_ib(cs)->size == 0) {
- sc_need_room(cs);
+ if (sc_ib(sc)->size == 0) {
+ sc_need_room(sc);
goto out;
}
@@ -2997,7 +2997,7 @@
}
}
- if (sc_ic(cs)->flags & CF_WRITE_PARTIAL)
+ if (sc_ic(sc)->flags & CF_WRITE_PARTIAL)
curpeer->statuscode = PEER_SESS_SC_CONNECTEDCODE;
reql = peer_getline(appctx);
@@ -3060,7 +3060,7 @@
curpeer->flags |= PEER_F_ALIVE;
/* skip consumed message */
- co_skip(sc_oc(cs), totl);
+ co_skip(sc_oc(sc), totl);
/* loop on that state to peek next message */
goto switchstate;
@@ -3127,15 +3127,15 @@
HA_SPIN_UNLOCK(PEER_LOCK, &curpeer->lock);
curpeer = NULL;
}
- 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;
goto out;
}
}
}
out:
- sc_oc(cs)->flags |= CF_READ_DONTWAIT;
+ sc_oc(sc)->flags |= CF_READ_DONTWAIT;
if (curpeer)
HA_SPIN_UNLOCK(PEER_LOCK, &curpeer->lock);