*/
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;
else
trash.area[n - 1] = 0;
- co_skip(sc_oc(cs), n);
+ co_skip(sc_oc(sc), n);
return n;
}
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) {
}
/* 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;
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;
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;
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;
return 1;
ignore_msg:
- co_skip(sc_oc(cs), totl);
+ co_skip(sc_oc(sc), totl);
return 0;
malformed_exit:
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;
/* 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;
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;
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;
*/
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;
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;
}
}
}
- 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);
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;
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);