CLEANUP: stconn: rename cs_rx_room_{blk,rdy} to sc_{need,have}_room()
The new name mor eclearly indicates that a stream connector cannot make
any more progress because it needs room in the channel buffer, or that
it may be unblocked because the buffer now has more room available. The
testing function is sc_waiting_room(). This is mostly used by applets.
Note that the flags will change soon.
diff --git a/src/applet.c b/src/applet.c
index 1af0dbd..718b299 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -238,7 +238,7 @@
*/
if (count != co_data(sc_oc(cs))) {
sc_oc(cs)->flags |= CF_WRITE_PARTIAL | CF_WROTE_DATA;
- cs_rx_room_rdy(cs_opposite(cs));
+ sc_have_room(cs_opposite(cs));
}
/* measure the call rate and check for anomalies when too high */
diff --git a/src/cache.c b/src/cache.c
index 22902a3..db75169 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1471,7 +1471,7 @@
/* Check if the input buffer is available. */
if (!b_size(&res->buf)) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
goto out;
}
@@ -1516,7 +1516,7 @@
if (len) {
ret = htx_cache_dump_msg(appctx, res_htx, len, HTX_BLK_UNUSED);
if (ret < len) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
goto out;
}
}
diff --git a/src/cli.c b/src/cli.c
index e684620..1a1b418 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -951,7 +951,7 @@
* would want to return some info right after parsing.
*/
if (buffer_almost_full(sc_ib(cs))) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
break;
}
@@ -1094,7 +1094,7 @@
appctx->st0 = CLI_ST_PROMPT;
}
else
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
break;
case CLI_ST_CALLBACK: /* use custom pointer */
diff --git a/src/conn_stream.c b/src/conn_stream.c
index b60a9c5..caf33e4 100644
--- a/src/conn_stream.c
+++ b/src/conn_stream.c
@@ -596,7 +596,7 @@
if (ic->pipe) {
/* stop reading */
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
}
else {
/* (re)start reading */
@@ -1021,7 +1021,7 @@
if (!channel_is_empty(ic) || !channel_may_recv(ic)) {
/* stop reading, imposed by channel's policy or contents */
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
}
else {
/* (re)start reading and update timeout. Note: we don't recompute the timeout
@@ -1029,7 +1029,7 @@
* update it if is was not yet set. The stream socket handler will already
* have updated it if there has been a completed I/O.
*/
- cs_rx_room_rdy(cs);
+ sc_have_room(cs);
}
if (sc_ep_test(cs, SE_FL_RXBLK_ANY))
ic->rex = TICK_ETERNITY;
@@ -1169,7 +1169,7 @@
* buffer or in the pipe.
*/
if (new_len < last_len)
- cs_rx_room_rdy(cs);
+ sc_have_room(cs);
}
if (!(ic->flags & CF_DONT_READ))
@@ -1375,7 +1375,7 @@
/* the pipe is full or we have read enough data that it
* could soon be full. Let's stop before needing to poll.
*/
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
goto done_recv;
}
@@ -1445,7 +1445,7 @@
*/
BUG_ON(c_empty(ic));
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
/* Add READ_PARTIAL because some data are pending but
* cannot be xferred to the channel
*/
@@ -1459,7 +1459,7 @@
* here to proceed.
*/
if (flags & CO_RFL_BUF_FLUSH)
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
break;
}
@@ -1753,7 +1753,7 @@
if (cs->state == SC_ST_CON)
cs->state = SC_ST_RDY;
- cs_rx_room_rdy(cs_opposite(cs));
+ sc_have_room(cs_opposite(cs));
}
if (sc_ep_test(cs, SE_FL_ERROR | SE_FL_ERR_PENDING)) {
diff --git a/src/dns.c b/src/dns.c
index 6156dba..29e7f3e 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -536,7 +536,7 @@
/* check if there is enough room to put message len and query id */
if (available_room < sizeof(slen) + sizeof(new_qid)) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
ret = 0;
break;
}
@@ -594,7 +594,7 @@
/* check if it remains available room on output chan */
if (unlikely(!available_room)) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
ret = 0;
break;
}
@@ -629,7 +629,7 @@
if (ds->tx_msg_offset) {
/* msg was not fully processed, we must be awake to drain pending data */
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
ret = 0;
break;
}
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index 47537d7..ac48c06 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -1149,7 +1149,7 @@
if (ret <= 0) {
if ((ret == -3 && b_is_null(&sc_ic(cs)->buf)) || ret == -1) {
/* WT: is this still needed for the case ret==-3 ? */
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
return 1; /* retry */
}
SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_IO;
diff --git a/src/hlua.c b/src/hlua.c
index 2601755..e931610 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -4662,7 +4662,7 @@
* applet, and returns a yield.
*/
if (l < len) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_send_yield, TICK_ETERNITY, 0));
}
@@ -5205,7 +5205,7 @@
if (l < len) {
snd_yield:
htx_to_buf(htx, &res->buf);
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_send_yield, TICK_ETERNITY, 0));
}
@@ -5510,7 +5510,7 @@
struct channel *res = sc_ic(cs);
if (co_data(res)) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_start_response_yield, TICK_ETERNITY, 0));
}
return MAY_LJMP(hlua_applet_http_send_response(L));
@@ -9527,7 +9527,7 @@
/* Check if the input buffer is available. */
if (!b_size(&res->buf)) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
goto out;
}
/* check that the output is not closed */
@@ -9607,7 +9607,7 @@
*/
if (htx_is_empty(res_htx) && (strm->txn->rsp.flags & (HTTP_MSGF_XFER_LEN|HTTP_MSGF_CNT_LEN)) == HTTP_MSGF_XFER_LEN) {
if (!htx_add_endof(res_htx, HTX_BLK_EOT)) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
goto out;
}
channel_add_input(res, 1);
@@ -10165,7 +10165,7 @@
case HLUA_E_AGAIN:
/* We want write. */
if (HLUA_IS_WAKERESWR(hlua))
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
/* Set the timeout. */
if (hlua->wake_time != TICK_ETERNITY)
task_schedule(hlua->task, hlua->wake_time);
diff --git a/src/http_ana.c b/src/http_ana.c
index 6f09f2a..9bcca5d 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -4193,7 +4193,7 @@
if ((htx->flags & HTX_FL_EOM) ||
htx_get_tail_type(htx) > HTX_BLK_DATA ||
channel_htx_full(chn, htx, global.tune.maxrewrite) ||
- cs_rx_blocked_room(chn_prod(chn)))
+ sc_waiting_room(chn_prod(chn)))
goto end;
if (bytes) {
diff --git a/src/http_client.c b/src/http_client.c
index 910cd0f..d0b2a58 100644
--- a/src/http_client.c
+++ b/src/http_client.c
@@ -247,7 +247,7 @@
out:
/* we didn't clear every flags, we should come back to finish things */
if (ctx->flags)
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
free_trash_chunk(trash);
return 0;
@@ -917,7 +917,7 @@
more:
/* There was not enough data in the response channel */
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
if (appctx->st0 == HTTPCLIENT_S_RES_END)
goto end;
diff --git a/src/peers.c b/src/peers.c
index cfa0b53..81af529 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -1215,7 +1215,7 @@
if (ret <= 0) {
if (ret == -1) {
/* No more write possible */
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
return -1;
}
appctx->st0 = PEER_SESS_ST_END;
@@ -2861,7 +2861,7 @@
/* Check if the input buffer is available. */
if (sc_ib(cs)->size == 0) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
goto out;
}
diff --git a/src/proxy.c b/src/proxy.c
index 26a4ad8..df46085 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -3296,7 +3296,7 @@
cant_send_unlock:
HA_RWLOCK_RDUNLOCK(PROXY_LOCK, &ctx->px->lock);
cant_send:
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
return 0;
}
diff --git a/src/resolvers.c b/src/resolvers.c
index f46aaef..2b3e128 100644
--- a/src/resolvers.c
+++ b/src/resolvers.c
@@ -2615,7 +2615,7 @@
return 1;
full:
- cs_rx_room_rdy(cs);
+ sc_have_room(cs);
return 0;
}
@@ -2662,7 +2662,7 @@
return 1;
full:
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
return 0;
}
diff --git a/src/stats.c b/src/stats.c
index 5aee449..8b55114 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -3216,7 +3216,7 @@
}
full:
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
return 0;
}
@@ -3711,7 +3711,7 @@
return 1;
full:
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
return 0;
}
@@ -3815,7 +3815,7 @@
}
full:
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
return 0;
}
@@ -4210,7 +4210,7 @@
full:
htx_reset(htx);
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
return 0;
}
@@ -4270,7 +4270,7 @@
full:
htx_reset(htx);
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
return 0;
}
@@ -4299,7 +4299,7 @@
/* Check if the input buffer is available. */
if (!b_size(&res->buf)) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
goto out;
}
@@ -4342,7 +4342,7 @@
*/
if (htx_is_empty(res_htx)) {
if (!htx_add_endof(res_htx, HTX_BLK_EOT)) {
- cs_rx_room_blk(cs);
+ sc_need_room(cs);
goto out;
}
channel_add_input(res, 1);
diff --git a/src/tcp_rules.c b/src/tcp_rules.c
index c8a3cb9..f9656c0 100644
--- a/src/tcp_rules.c
+++ b/src/tcp_rules.c
@@ -117,7 +117,7 @@
*/
if ((req->flags & (CF_EOI|CF_SHUTR|CF_READ_ERROR)) || channel_full(req, global.tune.maxrewrite) ||
- cs_rx_blocked_room(chn_prod(req)) ||
+ sc_waiting_room(chn_prod(req)) ||
!s->be->tcp_req.inspect_delay || tick_is_expired(s->rules_exp, now_ms))
partial = SMP_OPT_FINAL;
else
@@ -300,7 +300,7 @@
* - if one rule returns KO, then return KO
*/
if ((rep->flags & (CF_EOI|CF_SHUTR|CF_READ_ERROR)) || channel_full(rep, global.tune.maxrewrite) ||
- cs_rx_blocked_room(chn_prod(rep)) ||
+ sc_waiting_room(chn_prod(rep)) ||
!s->be->tcp_rep.inspect_delay || tick_is_expired(s->rules_exp, now_ms))
partial = SMP_OPT_FINAL;
else