REORG: channel: finally rename the last bi_* / bo_* functions
For HTTP/2 we'll need some buffer-only equivalent functions to some of
the ones applying to channels and still squatting the bi_* / bo_*
namespace. Since these names have kept being misleading for quite some
time now and are really getting annoying, it's time to rename them. This
commit will use "ci/co" as the prefix (for "channel in", "channel out")
instead of "bi/bo". The following ones were renamed :
bi_getblk_nc, bi_getline_nc, bi_putblk, bi_putchr,
bo_getblk, bo_getblk_nc, bo_getline, bo_getline_nc, bo_inject,
bi_putchk, bi_putstr, bo_getchr, bo_skip, bi_swpbuf
diff --git a/src/channel.c b/src/channel.c
index 0228072..853b85c 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -75,7 +75,7 @@
* data. Note: this function appends data to the buffer's output and possibly
* overwrites any pending input data which are assumed not to exist.
*/
-int bo_inject(struct channel *chn, const char *msg, int len)
+int co_inject(struct channel *chn, const char *msg, int len)
{
int max;
@@ -109,7 +109,7 @@
* buffer, -1 is returned. Otherwise the number of bytes copied is returned
* (1). Channel flag READ_PARTIAL is updated if some data can be transferred.
*/
-int bi_putchr(struct channel *chn, char c)
+int ci_putchr(struct channel *chn, char c)
{
if (unlikely(channel_input_closed(chn)))
return -2;
@@ -140,7 +140,7 @@
* number). Channel flag READ_PARTIAL is updated if some data can be
* transferred.
*/
-int bi_putblk(struct channel *chn, const char *blk, int len)
+int ci_putblk(struct channel *chn, const char *blk, int len)
{
int max;
@@ -198,7 +198,7 @@
* The chunk's length is updated with the number of bytes sent. On errors, NULL
* is returned. Note that only buf->i is considered.
*/
-struct buffer *bi_swpbuf(struct channel *chn, struct buffer *buf)
+struct buffer *ci_swpbuf(struct channel *chn, struct buffer *buf)
{
struct buffer *old;
@@ -236,12 +236,12 @@
* >0 : number of bytes read. Includes the \n if present before len or end.
* =0 : no '\n' before end found. <str> is left undefined.
* <0 : no more bytes readable because output is shut.
- * The channel status is not changed. The caller must call bo_skip() to
+ * The channel status is not changed. The caller must call co_skip() to
* update it. The '\n' is waited for as long as neither the buffer nor the
* output are full. If either of them is full, the string may be returned
* as is, without the '\n'.
*/
-int bo_getline(struct channel *chn, char *str, int len)
+int co_getline(struct channel *chn, char *str, int len)
{
int ret, max;
char *p;
@@ -287,10 +287,10 @@
* >0 : number of bytes read, equal to requested size.
* =0 : not enough data available. <blk> is left undefined.
* <0 : no more bytes readable because output is shut.
- * The channel status is not changed. The caller must call bo_skip() to
+ * The channel status is not changed. The caller must call co_skip() to
* update it.
*/
-int bo_getblk(struct channel *chn, char *blk, int len, int offset)
+int co_getblk(struct channel *chn, char *blk, int len, int offset)
{
int firstblock;
@@ -324,10 +324,10 @@
* >0 : number of blocks filled (1 or 2). blk1 is always filled before blk2.
* =0 : not enough data available. <blk*> are left undefined.
* <0 : no more bytes readable because output is shut.
- * The channel status is not changed. The caller must call bo_skip() to
+ * The channel status is not changed. The caller must call co_skip() to
* update it. Unused buffers are left in an undefined state.
*/
-int bo_getblk_nc(struct channel *chn, char **blk1, int *len1, char **blk2, int *len2)
+int co_getblk_nc(struct channel *chn, char **blk1, int *len1, char **blk2, int *len2)
{
if (unlikely(chn->buf->o == 0)) {
if (chn->flags & CF_SHUTW)
@@ -357,14 +357,14 @@
* full. If either of them is full, the string may be returned as is, without
* the '\n'. Unused buffers are left in an undefined state.
*/
-int bo_getline_nc(struct channel *chn,
+int co_getline_nc(struct channel *chn,
char **blk1, int *len1,
char **blk2, int *len2)
{
int retcode;
int l;
- retcode = bo_getblk_nc(chn, blk1, len1, blk2, len2);
+ retcode = co_getblk_nc(chn, blk1, len1, blk2, len2);
if (unlikely(retcode) <= 0)
return retcode;
@@ -401,7 +401,7 @@
* =0 : not enough data available.
* <0 : no more bytes readable because input is shut.
*/
-int bi_getblk_nc(struct channel *chn,
+int ci_getblk_nc(struct channel *chn,
char **blk1, int *len1,
char **blk2, int *len2)
{
@@ -433,14 +433,14 @@
* full. If either of them is full, the string may be returned as is, without
* the '\n'. Unused buffers are left in an undefined state.
*/
-int bi_getline_nc(struct channel *chn,
+int ci_getline_nc(struct channel *chn,
char **blk1, int *len1,
char **blk2, int *len2)
{
int retcode;
int l;
- retcode = bi_getblk_nc(chn, blk1, len1, blk2, len2);
+ retcode = ci_getblk_nc(chn, blk1, len1, blk2, len2);
if (unlikely(retcode <= 0))
return retcode;
diff --git a/src/cli.c b/src/cli.c
index bfed024..97e3086 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -485,7 +485,7 @@
struct chunk *tmp;
if (likely(severity_output == CLI_SEVERITY_NONE))
- return bi_putblk(chn, msg, strlen(msg));
+ return ci_putblk(chn, msg, strlen(msg));
tmp = get_trash_chunk();
chunk_reset(tmp);
@@ -508,7 +508,7 @@
}
chunk_appendf(tmp, "%s", msg);
- return bi_putblk(chn, tmp->str, strlen(tmp->str));
+ return ci_putblk(chn, tmp->str, strlen(tmp->str));
}
/* This I/O handler runs as an applet embedded in a stream interface. It is
@@ -561,7 +561,7 @@
break;
}
- reql = bo_getline(si_oc(si), trash.str, trash.size);
+ reql = co_getline(si_oc(si), trash.str, trash.size);
if (reql <= 0) { /* closed or EOL not found */
if (reql == 0)
break;
@@ -642,7 +642,7 @@
}
/* re-adjust req buffer */
- bo_skip(si_oc(si), reql);
+ co_skip(si_oc(si), reql);
req->flags |= CF_READ_DONTWAIT; /* we plan to read small requests */
}
else { /* output functions */
@@ -681,7 +681,7 @@
/* The post-command prompt is either LF alone or LF + '> ' in interactive mode */
if (appctx->st0 == CLI_ST_PROMPT) {
- if (bi_putstr(si_ic(si), appctx->st1 ? "\n> " : "\n") != -1)
+ if (ci_putstr(si_ic(si), appctx->st1 ? "\n> " : "\n") != -1)
appctx->st0 = CLI_ST_GETREQ;
else
si_applet_cant_put(si);
@@ -771,7 +771,7 @@
while (*var) {
chunk_printf(&trash, "%s\n", *var);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -869,7 +869,7 @@
chunk_appendf(&trash, "\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -899,7 +899,7 @@
switch (appctx->st2) {
case STAT_ST_INIT:
chunk_printf(&trash, "# socket lvl processes\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -966,7 +966,7 @@
chunk_appendf(&trash, "all\n");
}
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
diff --git a/src/dns.c b/src/dns.c
index 926e189..dbb473e 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -2657,7 +2657,7 @@
}
/* display response */
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
/* let's try again later from this session. We add ourselves into
* this session's users so that it can remove us upon termination.
*/
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index 08eb0b8..1d4b0c8 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -1110,7 +1110,7 @@
* length. */
netint = htonl(framesz);
memcpy(buf, (char *)&netint, 4);
- ret = bi_putblk(si_ic(si), buf, framesz+4);
+ ret = ci_putblk(si_ic(si), buf, framesz+4);
if (ret <= 0) {
if (ret == -1) {
@@ -1137,14 +1137,14 @@
if (si_oc(si)->buf == &buf_empty)
goto retry;
- ret = bo_getblk(si_oc(si), (char *)&netint, 4, 0);
+ ret = co_getblk(si_oc(si), (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 = bo_getblk(si_oc(si), buf, framesz, 4);
+ ret = co_getblk(si_oc(si), buf, framesz, 4);
}
if (ret <= 0) {
if (ret == 0) {
@@ -1407,7 +1407,7 @@
next:
/* Do not forget to remove processed frame from the output buffer */
if (trash.len)
- bo_skip(si_oc(si), trash.len);
+ co_skip(si_oc(si), trash.len);
SPOE_APPCTX(appctx)->task->expire =
tick_add_ifset(now_ms, agent->timeout.idle);
@@ -1583,7 +1583,7 @@
/* Do not forget to remove processed frame from the output buffer */
if (trash.len)
- bo_skip(si_oc(appctx->owner), trash.len);
+ co_skip(si_oc(appctx->owner), trash.len);
end:
return ret;
}
@@ -1798,7 +1798,7 @@
next:
/* Do not forget to remove processed frame from the output buffer */
if (trash.len)
- bo_skip(si_oc(appctx->owner), trash.len);
+ co_skip(si_oc(appctx->owner), trash.len);
return 0;
stop:
diff --git a/src/hlua.c b/src/hlua.c
index 7eddda8..f5fed04 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -1662,7 +1662,7 @@
oc = &s->res;
if (wanted == HLSR_READ_LINE) {
/* Read line. */
- nblk = bo_getline_nc(oc, &blk1, &len1, &blk2, &len2);
+ nblk = co_getline_nc(oc, &blk1, &len1, &blk2, &len2);
if (nblk < 0) /* Connection close. */
goto connection_closed;
if (nblk == 0) /* No data avalaible. */
@@ -1693,7 +1693,7 @@
else if (wanted == HLSR_READ_ALL) {
/* Read all the available data. */
- nblk = bo_getblk_nc(oc, &blk1, &len1, &blk2, &len2);
+ nblk = co_getblk_nc(oc, &blk1, &len1, &blk2, &len2);
if (nblk < 0) /* Connection close. */
goto connection_closed;
if (nblk == 0) /* No data avalaible. */
@@ -1702,7 +1702,7 @@
else {
/* Read a block of data. */
- nblk = bo_getblk_nc(oc, &blk1, &len1, &blk2, &len2);
+ nblk = co_getblk_nc(oc, &blk1, &len1, &blk2, &len2);
if (nblk < 0) /* Connection close. */
goto connection_closed;
if (nblk == 0) /* No data avalaible. */
@@ -1724,7 +1724,7 @@
}
/* Consume data. */
- bo_skip(oc, len + skip_at_end);
+ co_skip(oc, len + skip_at_end);
/* Don't wait anything. */
stream_int_notify(&s->si[0]);
@@ -1904,7 +1904,7 @@
/* send data */
if (len < send_len)
send_len = len;
- len = bi_putblk(&s->req, buf+sent, send_len);
+ len = ci_putblk(&s->req, buf+sent, send_len);
/* "Not enough space" (-1), "Buffer too little to contain
* the data" (-2) are not expected because the available length
@@ -2551,7 +2551,7 @@
int ret;
luaL_Buffer b;
- ret = bi_getblk_nc(chn, &blk1, &len1, &blk2, &len2);
+ ret = ci_getblk_nc(chn, &blk1, &len1, &blk2, &len2);
if (unlikely(ret == 0))
return 0;
@@ -2643,7 +2643,7 @@
chn = MAY_LJMP(hlua_checkchannel(L, 1));
- ret = bi_getline_nc(chn, &blk1, &len1, &blk2, &len2);
+ ret = ci_getline_nc(chn, &blk1, &len1, &blk2, &len2);
if (ret == 0)
WILL_LJMP(hlua_yieldk(L, 0, 0, hlua_channel_getline_yield, TICK_ETERNITY, 0));
@@ -2701,7 +2701,7 @@
if (max > len - l)
max = len - l;
- ret = bi_putblk(chn, str + l, max);
+ ret = ci_putblk(chn, str + l, max);
if (ret == -2 || ret == -3) {
lua_pushinteger(L, -1);
return 1;
@@ -3411,7 +3411,7 @@
int len2;
/* Read the maximum amount of data avalaible. */
- ret = bo_getline_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
+ ret = co_getline_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
/* Data not yet avalaible. return yield. */
if (ret == 0) {
@@ -3434,7 +3434,7 @@
luaL_addlstring(&appctx->b, blk2, len2);
/* Consume input channel output buffer data. */
- bo_skip(si_oc(si), len1 + len2);
+ co_skip(si_oc(si), len1 + len2);
luaL_pushresult(&appctx->b);
return 1;
}
@@ -3466,7 +3466,7 @@
int len2;
/* Read the maximum amount of data avalaible. */
- ret = bo_getblk_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
+ ret = co_getblk_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
/* Data not yet avalaible. return yield. */
if (ret == 0) {
@@ -3492,7 +3492,7 @@
*/
luaL_addlstring(&appctx->b, blk1, len1);
luaL_addlstring(&appctx->b, blk2, len2);
- bo_skip(si_oc(si), len1 + len2);
+ co_skip(si_oc(si), len1 + len2);
si_applet_cant_get(si);
WILL_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_recv_yield, TICK_ETERNITY, 0));
@@ -3511,7 +3511,7 @@
len -= len2;
/* Consume input channel output buffer data. */
- bo_skip(si_oc(si), len1 + len2);
+ co_skip(si_oc(si), len1 + len2);
/* If we are no other data avalaible, yield waiting for new data. */
if (len > 0) {
@@ -3575,7 +3575,7 @@
max = len - l;
/* Copy data. */
- bi_putblk(chn, str + l, max);
+ ci_putblk(chn, str + l, max);
/* update counters. */
l += max;
@@ -3875,7 +3875,7 @@
/* Maybe we cant send a 100-continue ? */
if (appctx->appctx->ctx.hlua_apphttp.flags & APPLET_100C) {
- ret = bi_putblk(chn, HTTP_100C, strlen(HTTP_100C));
+ ret = ci_putblk(chn, HTTP_100C, strlen(HTTP_100C));
/* if ret == -2 or -3 the channel closed or the message si too
* big for the buffers. We cant send anything. So, we ignoring
* the error, considers that the 100-continue is sent, and try
@@ -3896,7 +3896,7 @@
}
/* Read the maximum amount of data avalaible. */
- ret = bo_getline_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
+ ret = co_getline_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
/* Data not yet avalaible. return yield. */
if (ret == 0) {
@@ -3927,7 +3927,7 @@
appctx->appctx->ctx.hlua_apphttp.left_bytes -= len2;
/* Consume input channel output buffer data. */
- bo_skip(si_oc(si), len1 + len2);
+ co_skip(si_oc(si), len1 + len2);
luaL_pushresult(&appctx->b);
return 1;
}
@@ -3961,7 +3961,7 @@
/* Maybe we cant send a 100-continue ? */
if (appctx->appctx->ctx.hlua_apphttp.flags & APPLET_100C) {
- ret = bi_putblk(chn, HTTP_100C, strlen(HTTP_100C));
+ ret = ci_putblk(chn, HTTP_100C, strlen(HTTP_100C));
/* if ret == -2 or -3 the channel closed or the message si too
* big for the buffers. We cant send anything. So, we ignoring
* the error, considers that the 100-continue is sent, and try
@@ -3976,7 +3976,7 @@
}
/* Read the maximum amount of data avalaible. */
- ret = bo_getblk_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
+ ret = co_getblk_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
/* Data not yet avalaible. return yield. */
if (ret == 0) {
@@ -4007,7 +4007,7 @@
len -= len2;
/* Consume input channel output buffer data. */
- bo_skip(si_oc(si), len1 + len2);
+ co_skip(si_oc(si), len1 + len2);
if (appctx->appctx->ctx.hlua_apphttp.left_bytes != -1)
appctx->appctx->ctx.hlua_apphttp.left_bytes -= len;
@@ -4070,7 +4070,7 @@
max = len - l;
/* Copy data. */
- bi_putblk(chn, str + l, max);
+ ci_putblk(chn, str + l, max);
/* update counters. */
l += max;
@@ -4209,7 +4209,7 @@
msg = MAY_LJMP(luaL_checklstring(L, 2, &len));
/* Send the message at once. */
- ret = bi_putblk(chn, msg, len);
+ ret = ci_putblk(chn, msg, len);
/* if ret == -2 or -3 the channel closed or the message si too
* big for the buffers.
@@ -6136,7 +6136,7 @@
strm->logs.tv_request = now;
/* eat the whole request */
- bo_skip(si_oc(si), si_ob(si)->o);
+ co_skip(si_oc(si), si_ob(si)->o);
res->flags |= CF_READ_NULL;
si_shutr(si);
return;
@@ -6352,7 +6352,7 @@
*/
/* Read the maximum amount of data avalaible. */
- ret = bo_getblk_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
+ ret = co_getblk_nc(si_oc(si), &blk1, &len1, &blk2, &len2);
if (ret == -1)
return;
@@ -6367,7 +6367,7 @@
}
/* skip the requests bytes. */
- bo_skip(si_oc(si), strm->txn->req.eoh + 2);
+ co_skip(si_oc(si), strm->txn->req.eoh + 2);
}
/* Executes The applet if it is not done. */
@@ -6412,7 +6412,7 @@
!(ctx->ctx.hlua_apphttp.flags & APPLET_LAST_CHK)) {
/* sent last chunk at once. */
- ret = bi_putblk(res, "0\r\n\r\n", 5);
+ ret = ci_putblk(res, "0\r\n\r\n", 5);
/* critical error. */
if (ret == -2 || ret == -3) {
@@ -6438,7 +6438,7 @@
strm->logs.tv_request = now;
/* eat the whole request */
- bo_skip(si_oc(si), si_ob(si)->o);
+ co_skip(si_oc(si), si_ob(si)->o);
res->flags |= CF_READ_NULL;
si_shutr(si);
@@ -6452,7 +6452,7 @@
* if there are no room avalaible in the buffer,
* just close the connection.
*/
- bi_putblk(res, error_500, strlen(error_500));
+ ci_putblk(res, error_500, strlen(error_500));
if (!(strm->flags & SF_ERR_MASK))
strm->flags |= SF_ERR_RESOURCE;
si_shutw(si);
diff --git a/src/map.c b/src/map.c
index 816fd66..dc4dd95 100644
--- a/src/map.c
+++ b/src/map.c
@@ -350,7 +350,7 @@
chunk_appendf(&trash, "%p %s\n",
elt, elt->pattern);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
/* let's try again later from this stream. We add ourselves into
* this stream's users so that it can remove us upon termination.
*/
@@ -384,7 +384,7 @@
*/
chunk_reset(&trash);
chunk_appendf(&trash, "# id (file) description\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -411,7 +411,7 @@
appctx->ctx.map.ref->reference ? appctx->ctx.map.ref->reference : "",
appctx->ctx.map.ref->display);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
/* let's try again later from this stream. We add ourselves into
* this stream's users so that it can remove us upon termination.
*/
@@ -530,7 +530,7 @@
chunk_appendf(&trash, "\n");
/* display response */
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
/* let's try again later from this stream. We add ourselves into
* this stream's users so that it can remove us upon termination.
*/
diff --git a/src/memory.c b/src/memory.c
index 9f8396d..24e1df7 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -282,7 +282,7 @@
struct stream_interface *si = appctx->owner;
dump_pools_to_trash();
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
diff --git a/src/peers.c b/src/peers.c
index 21a556b..4c85af5 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -581,7 +581,7 @@
appctx->st0 = PEER_SESS_ST_GETVERSION;
/* fall through */
case PEER_SESS_ST_GETVERSION:
- reql = bo_getline(si_oc(si), trash.str, trash.size);
+ reql = co_getline(si_oc(si), trash.str, trash.size);
if (reql <= 0) { /* closed or EOL not found */
if (reql == 0)
goto out;
@@ -597,7 +597,7 @@
else
trash.str[reql-1] = 0;
- bo_skip(si_oc(si), reql);
+ co_skip(si_oc(si), reql);
/* test protocol */
if (strncmp(PEER_SESSION_PROTO_NAME " ", trash.str, proto_len + 1) != 0) {
@@ -615,7 +615,7 @@
appctx->st0 = PEER_SESS_ST_GETHOST;
/* fall through */
case PEER_SESS_ST_GETHOST:
- reql = bo_getline(si_oc(si), trash.str, trash.size);
+ reql = co_getline(si_oc(si), trash.str, trash.size);
if (reql <= 0) { /* closed or EOL not found */
if (reql == 0)
goto out;
@@ -631,7 +631,7 @@
else
trash.str[reql-1] = 0;
- bo_skip(si_oc(si), reql);
+ co_skip(si_oc(si), reql);
/* test hostname match */
if (strcmp(localpeer, trash.str) != 0) {
@@ -645,7 +645,7 @@
case PEER_SESS_ST_GETPEER: {
struct peer *curpeer;
char *p;
- reql = bo_getline(si_oc(si), trash.str, trash.size);
+ reql = co_getline(si_oc(si), trash.str, trash.size);
if (reql <= 0) { /* closed or EOL not found */
if (reql == 0)
goto out;
@@ -662,7 +662,7 @@
else
trash.str[reql-1] = 0;
- bo_skip(si_oc(si), reql);
+ co_skip(si_oc(si), reql);
/* parse line "<peer name> <pid> <relative_pid>" */
p = strchr(trash.str, ' ');
@@ -713,7 +713,7 @@
struct shared_table *st;
repl = snprintf(trash.str, trash.size, "%d\n", PEER_SESS_SC_SUCCESSCODE);
- repl = bi_putblk(si_ic(si), trash.str, repl);
+ repl = ci_putblk(si_ic(si), trash.str, repl);
if (repl <= 0) {
if (repl == -1)
goto full;
@@ -781,7 +781,7 @@
goto switchstate;
}
- repl = bi_putblk(si_ic(si), trash.str, repl);
+ repl = ci_putblk(si_ic(si), trash.str, repl);
if (repl <= 0) {
if (repl == -1)
goto full;
@@ -800,7 +800,7 @@
if (si_ic(si)->flags & CF_WRITE_PARTIAL)
curpeer->statuscode = PEER_SESS_SC_CONNECTEDCODE;
- reql = bo_getline(si_oc(si), trash.str, trash.size);
+ reql = co_getline(si_oc(si), trash.str, trash.size);
if (reql <= 0) { /* closed or EOL not found */
if (reql == 0)
goto out;
@@ -817,7 +817,7 @@
else
trash.str[reql-1] = 0;
- bo_skip(si_oc(si), reql);
+ co_skip(si_oc(si), reql);
/* Register status code */
curpeer->statuscode = atoi(trash.str);
@@ -876,7 +876,7 @@
unsigned char msg_head[7];
int totl = 0;
- reql = bo_getblk(si_oc(si), (char *)msg_head, 2*sizeof(unsigned char), totl);
+ reql = co_getblk(si_oc(si), (char *)msg_head, 2*sizeof(unsigned char), totl);
if (reql <= 0) /* closed or EOL not found */
goto incomplete;
@@ -884,7 +884,7 @@
if (msg_head[1] >= 128) {
/* Read and Decode message length */
- reql = bo_getblk(si_oc(si), (char *)&msg_head[2], sizeof(unsigned char), totl);
+ reql = co_getblk(si_oc(si), (char *)&msg_head[2], sizeof(unsigned char), totl);
if (reql <= 0) /* closed */
goto incomplete;
@@ -899,7 +899,7 @@
char *end;
for (i = 3 ; i < sizeof(msg_head) ; i++) {
- reql = bo_getblk(si_oc(si), (char *)&msg_head[i], sizeof(char), totl);
+ reql = co_getblk(si_oc(si), (char *)&msg_head[i], sizeof(char), totl);
if (reql <= 0) /* closed */
goto incomplete;
@@ -934,7 +934,7 @@
goto switchstate;
}
- reql = bo_getblk(si_oc(si), trash.str, msg_len, totl);
+ reql = co_getblk(si_oc(si), trash.str, msg_len, totl);
if (reql <= 0) /* closed */
goto incomplete;
totl += reql;
@@ -1332,12 +1332,12 @@
ignore_msg:
/* skip consumed message */
- bo_skip(si_oc(si), totl);
+ co_skip(si_oc(si), totl);
/* loop on that state to peek next message */
goto switchstate;
incomplete:
- /* we get here when a bo_getblk() returns <= 0 in reql */
+ /* we get here when a co_getblk() returns <= 0 in reql */
if (reql < 0) {
/* there was an error */
@@ -1359,7 +1359,7 @@
msg[1] = PEER_MSG_CTRL_RESYNCREQ;
/* message to buffer */
- repl = bi_putblk(si_ic(si), (char *)msg, sizeof(msg));
+ repl = ci_putblk(si_ic(si), (char *)msg, sizeof(msg));
if (repl <= 0) {
/* no more write possible */
if (repl == -1)
@@ -1397,7 +1397,7 @@
}
/* message to buffer */
- repl = bi_putblk(si_ic(si), trash.str, msglen);
+ repl = ci_putblk(si_ic(si), trash.str, msglen);
if (repl <= 0) {
/* no more write possible */
if (repl == -1) {
@@ -1426,7 +1426,7 @@
}
/* message to buffer */
- repl = bi_putblk(si_ic(si), trash.str, msglen);
+ repl = ci_putblk(si_ic(si), trash.str, msglen);
if (repl <= 0) {
/* no more write possible */
if (repl == -1) {
@@ -1468,7 +1468,7 @@
}
/* message to buffer */
- repl = bi_putblk(si_ic(si), trash.str, msglen);
+ repl = ci_putblk(si_ic(si), trash.str, msglen);
if (repl <= 0) {
/* no more write possible */
if (repl == -1) {
@@ -1503,7 +1503,7 @@
}
/* message to buffer */
- repl = bi_putblk(si_ic(si), trash.str, msglen);
+ repl = ci_putblk(si_ic(si), trash.str, msglen);
if (repl <= 0) {
/* no more write possible */
if (repl == -1) {
@@ -1542,7 +1542,7 @@
}
/* message to buffer */
- repl = bi_putblk(si_ic(si), trash.str, msglen);
+ repl = ci_putblk(si_ic(si), trash.str, msglen);
if (repl <= 0) {
/* no more write possible */
if (repl == -1) {
@@ -1574,7 +1574,7 @@
}
/* message to buffer */
- repl = bi_putblk(si_ic(si), trash.str, msglen);
+ repl = ci_putblk(si_ic(si), trash.str, msglen);
if (repl <= 0) {
/* no more write possible */
if (repl == -1) {
@@ -1610,7 +1610,7 @@
}
/* message to buffer */
- repl = bi_putblk(si_ic(si), trash.str, msglen);
+ repl = ci_putblk(si_ic(si), trash.str, msglen);
if (repl <= 0) {
/* no more write possible */
if (repl == -1) {
@@ -1642,7 +1642,7 @@
msg[0] = PEER_MSG_CLASS_CONTROL;
msg[1] = ((curpeers->flags & PEERS_RESYNC_STATEMASK) == PEERS_RESYNC_FINISHED) ? PEER_MSG_CTRL_RESYNCFINISHED : PEER_MSG_CTRL_RESYNCPARTIAL;
/* process final lesson message */
- repl = bi_putblk(si_ic(si), (char *)msg, sizeof(msg));
+ repl = ci_putblk(si_ic(si), (char *)msg, sizeof(msg));
if (repl <= 0) {
/* no more write possible */
if (repl == -1)
@@ -1663,7 +1663,7 @@
msg[1] = PEER_MSG_CTRL_RESYNCCONFIRM;
/* message to buffer */
- repl = bi_putblk(si_ic(si), (char *)msg, sizeof(msg));
+ repl = ci_putblk(si_ic(si), (char *)msg, sizeof(msg));
if (repl <= 0) {
/* no more write possible */
if (repl == -1)
@@ -1679,7 +1679,7 @@
}
case PEER_SESS_ST_EXIT:
repl = snprintf(trash.str, trash.size, "%d\n", appctx->st1);
- if (bi_putblk(si_ic(si), trash.str, repl) == -1)
+ if (ci_putblk(si_ic(si), trash.str, repl) == -1)
goto full;
appctx->st0 = PEER_SESS_ST_END;
goto switchstate;
@@ -1689,7 +1689,7 @@
msg[0] = PEER_MSG_CLASS_ERROR;
msg[1] = PEER_MSG_ERR_SIZELIMIT;
- if (bi_putblk(si_ic(si), (char *)msg, sizeof(msg)) == -1)
+ if (ci_putblk(si_ic(si), (char *)msg, sizeof(msg)) == -1)
goto full;
appctx->st0 = PEER_SESS_ST_END;
goto switchstate;
@@ -1700,7 +1700,7 @@
msg[0] = PEER_MSG_CLASS_ERROR;
msg[1] = PEER_MSG_ERR_PROTOCOL;
- if (bi_putblk(si_ic(si), (char *)msg, sizeof(msg)) == -1)
+ if (ci_putblk(si_ic(si), (char *)msg, sizeof(msg)) == -1)
goto full;
appctx->st0 = PEER_SESS_ST_END;
/* fall through */
diff --git a/src/proto_http.c b/src/proto_http.c
index e6107ee..c83e942 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -1051,7 +1051,7 @@
channel_auto_close(si_ic(si));
channel_auto_read(si_ic(si));
if (msg)
- bo_inject(si_ic(si), msg->str, msg->len);
+ co_inject(si_ic(si), msg->str, msg->len);
if (!(s->flags & SF_ERR_MASK))
s->flags |= err;
if (!(s->flags & SF_FINST_MASK))
@@ -4225,7 +4225,7 @@
memcpy(chunk->str + chunk->len, "\r\n\r\n", 4);
chunk->len += 4;
FLT_STRM_CB(s, flt_http_reply(s, txn->status, chunk));
- bo_inject(res->chn, chunk->str, chunk->len);
+ co_inject(res->chn, chunk->str, chunk->len);
/* "eat" the request */
bi_fast_delete(req->chn->buf, req->sov);
req->next -= req->sov;
@@ -4927,7 +4927,7 @@
/* Expect is allowed in 1.1, look for it */
if (http_find_header2("Expect", 6, req->buf->p, &txn->hdr_idx, &ctx) &&
unlikely(ctx.vlen == 12 && strncasecmp(ctx.line+ctx.val, "100-continue", 12) == 0)) {
- bo_inject(&s->res, http_100_chunk.str, http_100_chunk.len);
+ co_inject(&s->res, http_100_chunk.str, http_100_chunk.len);
http_remove_header2(&txn->req, &txn->hdr_idx, &ctx);
}
}
@@ -13157,7 +13157,7 @@
tm.tm_hour, tm.tm_min, tm.tm_sec, (int)(date.tv_usec/1000),
error_snapshot_id);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
/* Socket buffer full. Let's try again later from the same point */
si_applet_cant_put(si);
return 0;
@@ -13247,7 +13247,7 @@
es->b_flags, es->b_out, es->b_tot,
es->len, es->b_wrap, es->pos);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
/* Socket buffer full. Let's try again later from the same point */
si_applet_cant_put(si);
return 0;
@@ -13260,7 +13260,7 @@
/* the snapshot changed while we were dumping it */
chunk_appendf(&trash,
" WARNING! update detected on this snapshot, dump interrupted. Please re-check!\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -13277,7 +13277,7 @@
if (newptr == appctx->ctx.errors.ptr)
return 0;
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
/* Socket buffer full. Let's try again later from the same point */
si_applet_cant_put(si);
return 0;
diff --git a/src/proxy.c b/src/proxy.c
index ec1f60a..52a17c2 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -1467,7 +1467,7 @@
srv->cur_state, srv->cur_admin, srv->uweight, srv->iweight, (long int)srv_time_since_last_change,
srv->check.status, srv->check.result, srv->check.health, srv->check.state, srv->agent.state,
bk_f_forced_id, srv_f_forced_id, srv->hostname ? srv->hostname : "-", srv->svc_port);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -1495,7 +1495,7 @@
if (appctx->st2 == STAT_ST_HEAD) {
chunk_printf(&trash, "%d\n# %s\n", SRV_STATE_FILE_VERSION, SRV_STATE_FILE_FIELD_NAMES);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -1531,7 +1531,7 @@
if (!appctx->ctx.cli.p0) {
chunk_printf(&trash, "# name\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -1550,7 +1550,7 @@
continue;
chunk_appendf(&trash, "%s\n", curproxy->id);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
diff --git a/src/server.c b/src/server.c
index 65c2c14..b937c19 100644
--- a/src/server.c
+++ b/src/server.c
@@ -4232,7 +4232,7 @@
/* return server's effective weight at the moment */
snprintf(trash.str, trash.size, "%d (initial %d)\n", sv->uweight, sv->iweight);
- if (bi_putstr(si_ic(si), trash.str) == -1) {
+ if (ci_putstr(si_ic(si), trash.str) == -1) {
si_applet_cant_put(si);
return 0;
}
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 1d00b42..6096f46 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -7718,7 +7718,7 @@
else
chunk_appendf(&trash, "# id (file)\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -7758,7 +7758,7 @@
sizeof(struct tls_sess_key), t2->str, t2->size);
chunk_appendf(&trash, "%d.%d %s\n", ref->unique_id, appctx->ctx.cli.i1, t2->str);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
/* let's try again later from this stream. We add ourselves into
* this stream's users so that it can remove us upon termination.
*/
@@ -7769,7 +7769,7 @@
}
appctx->ctx.cli.i1 = 0;
}
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
/* let's try again later from this stream. We add ourselves into
* this stream's users so that it can remove us upon termination.
*/
diff --git a/src/stats.c b/src/stats.c
index 25d6e65..614350d 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -2008,7 +2008,7 @@
case STAT_PX_ST_TH:
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
stats_dump_html_px_hdr(si, px, uri);
- if (bi_putchk(rep, &trash) == -1) {
+ if (ci_putchk(rep, &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2020,7 +2020,7 @@
case STAT_PX_ST_FE:
/* print the frontend */
if (stats_dump_fe_stats(si, px)) {
- if (bi_putchk(rep, &trash) == -1) {
+ if (ci_putchk(rep, &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2052,7 +2052,7 @@
/* print the frontend */
if (stats_dump_li_stats(si, px, l, flags)) {
- if (bi_putchk(rep, &trash) == -1) {
+ if (ci_putchk(rep, &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2096,7 +2096,7 @@
}
if (stats_dump_sv_stats(si, px, flags, sv)) {
- if (bi_putchk(rep, &trash) == -1) {
+ if (ci_putchk(rep, &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2109,7 +2109,7 @@
case STAT_PX_ST_BE:
/* print the backend */
if (stats_dump_be_stats(si, px, flags)) {
- if (bi_putchk(rep, &trash) == -1) {
+ if (ci_putchk(rep, &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2121,7 +2121,7 @@
case STAT_PX_ST_END:
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
stats_dump_html_px_end(si, px);
- if (bi_putchk(rep, &trash) == -1) {
+ if (ci_putchk(rep, &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2533,7 +2533,7 @@
else if (!(appctx->ctx.stats.flags & STAT_FMT_TYPED))
stats_dump_csv_header();
- if (bi_putchk(rep, &trash) == -1) {
+ if (ci_putchk(rep, &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2544,7 +2544,7 @@
case STAT_ST_INFO:
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
stats_dump_html_info(si, uri);
- if (bi_putchk(rep, &trash) == -1) {
+ if (ci_putchk(rep, &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2583,7 +2583,7 @@
stats_dump_html_end();
else
stats_dump_json_end();
- if (bi_putchk(rep, &trash) == -1) {
+ if (ci_putchk(rep, &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2636,7 +2636,7 @@
goto out;
}
- reql = bo_getblk(si_oc(si), temp->str, s->txn->req.body_len, s->txn->req.eoh + 2);
+ reql = co_getblk(si_oc(si), temp->str, s->txn->req.body_len, s->txn->req.eoh + 2);
if (reql <= 0) {
/* we need more data */
appctx->ctx.stats.st_code = STAT_STATUS_NONE;
@@ -2953,7 +2953,7 @@
s->txn->status = 200;
s->logs.tv_request = now;
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -3001,7 +3001,7 @@
s->txn->status = 303;
s->logs.tv_request = now;
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -3060,7 +3060,7 @@
last_fwd = si_ic(si)->to_forward;
si_ic(si)->to_forward = 0;
chunk_printf(&trash, "\r\n000000\r\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
si_ic(si)->to_forward = last_fwd;
goto out;
@@ -3086,7 +3086,7 @@
if (last_len != data_len) {
chunk_printf(&trash, "\r\n%06x\r\n", (last_len - data_len));
- if (bi_putchk(si_ic(si), &trash) == -1)
+ if (ci_putchk(si_ic(si), &trash) == -1)
si_applet_cant_put(si);
si_ic(si)->total += (last_len - data_len);
@@ -3112,13 +3112,13 @@
if (appctx->st0 == STAT_HTTP_DONE) {
if (appctx->ctx.stats.flags & STAT_CHUNKED) {
chunk_printf(&trash, "\r\n0\r\n\r\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
goto out;
}
}
/* eat the whole request */
- bo_skip(si_oc(si), si_ob(si)->o);
+ co_skip(si_oc(si), si_ob(si)->o);
res->flags |= CF_READ_NULL;
si_shutr(si);
}
@@ -3290,7 +3290,7 @@
else
stats_dump_info_fields(&trash, info);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -3518,7 +3518,7 @@
stats_dump_json_schema(&trash);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
diff --git a/src/stick_table.c b/src/stick_table.c
index 0caa075..d95c77f 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -2256,7 +2256,7 @@
if (target && (strm_li(s)->bind_conf->level & ACCESS_LVL_MASK) < ACCESS_LVL_OPER)
chunk_appendf(msg, "# contents not dumped due to insufficient privileges\n");
- if (bi_putchk(si_ic(si), msg) == -1) {
+ if (ci_putchk(si_ic(si), msg) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2329,7 +2329,7 @@
}
chunk_appendf(msg, "\n");
- if (bi_putchk(si_ic(si), msg) == -1) {
+ if (ci_putchk(si_ic(si), msg) == -1) {
si_applet_cant_put(si);
return 0;
}
diff --git a/src/stream.c b/src/stream.c
index 8c8084c..fe01639 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -2662,7 +2662,7 @@
if (appctx->ctx.sess.section > 0 && appctx->ctx.sess.uid != strm->uniq_id) {
/* stream changed, no need to go any further */
chunk_appendf(&trash, " *** session terminated while we were watching it ***\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -2945,7 +2945,7 @@
strm->txn ? strm->txn->rsp.next : 0, strm->res.buf->i,
strm->res.buf->size);
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
@@ -3156,7 +3156,7 @@
chunk_appendf(&trash, "\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
/* let's try again later from this stream. We add ourselves into
* this stream's users so that it can remove us upon termination.
*/
@@ -3176,7 +3176,7 @@
else
chunk_appendf(&trash, "Session not found.\n");
- if (bi_putchk(si_ic(si), &trash) == -1) {
+ if (ci_putchk(si_ic(si), &trash) == -1) {
si_applet_cant_put(si);
return 0;
}
diff --git a/src/stream_interface.c b/src/stream_interface.c
index a5bd3ed..eaf4e45 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -143,7 +143,7 @@
channel_truncate(oc);
if (likely(msg && msg->len))
- bo_inject(oc, msg->str, msg->len);
+ co_inject(oc, msg->str, msg->len);
oc->wex = tick_add_ifset(now_ms, oc->wto);
channel_auto_read(oc);