diff --git a/contrib/debug/flags.c b/contrib/debug/flags.c index 545e6c234..e0d191dd5 100644 --- a/contrib/debug/flags.c +++ b/contrib/debug/flags.c @@ -211,7 +211,7 @@ void show_si_flags(unsigned int f) SHOW_FLAG(f, SI_FL_EXP); SHOW_FLAG(f, SI_FL_ERR); - SHOW_FLAG(f, SI_FL_WAIT_ROOM); + SHOW_FLAG(f, SI_FL_RXBLK_ROOM); SHOW_FLAG(f, SI_FL_WAIT_DATA); SHOW_FLAG(f, SI_FL_ISBACK); SHOW_FLAG(f, SI_FL_DONT_WAKE); diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index 79cba8562..ad0fe031e 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -256,7 +256,7 @@ static inline void si_want_put(struct stream_interface *si) /* Report that a stream interface failed to put some data into the input buffer */ static inline void si_cant_put(struct stream_interface *si) { - si->flags |= SI_FL_WANT_PUT | SI_FL_WAIT_ROOM; + si->flags |= SI_FL_WANT_PUT | SI_FL_RXBLK_ROOM; } /* Report that a stream interface doesn't want to put data into the input buffer */ @@ -268,7 +268,7 @@ static inline void si_stop_put(struct stream_interface *si) /* Report that a stream interface won't put any more data into the input buffer */ static inline void si_done_put(struct stream_interface *si) { - si->flags &= ~(SI_FL_WANT_PUT | SI_FL_WAIT_ROOM); + si->flags &= ~(SI_FL_WANT_PUT | SI_FL_RXBLK_ROOM); } /* Report that a stream interface wants to get some data from the output buffer */ @@ -317,7 +317,7 @@ static inline struct conn_stream *si_alloc_cs(struct stream_interface *si, struc * channel_alloc_buffer() for this so it abides by its rules. It returns 0 on * failure, non-zero otherwise. If no buffer is available, the requester, * represented by pointer, will be added in the list of objects waiting - * for an available buffer, and SI_FL_WAIT_ROOM will be set on the stream-int. + * for an available buffer, and SI_FL_RXBLK_ROOM will be set on the stream-int. * The requester will be responsible for calling this function to try again * once woken up. */ @@ -363,12 +363,12 @@ static inline void si_shutw(struct stream_interface *si) } /* This is to be used after making some room available in a channel. It will - * return without doing anything if {SI_FL_WANT_PUT,SI_FL_WAIT_ROOM} != {1,0}. + * return without doing anything if {SI_FL_WANT_PUT,SI_FL_RXBLK_ROOM} != {1,0}. * It will then call ->chk_rcv() to enable receipt of new data. */ static inline void si_chk_rcv(struct stream_interface *si) { - if (si->flags & SI_FL_WAIT_ROOM) + if (si->flags & SI_FL_RXBLK_ROOM) return; if (!(si->flags & SI_FL_WANT_PUT)) @@ -402,7 +402,7 @@ static inline int si_sync_recv(struct stream_interface *si) if (si->wait_event.wait_reason & SUB_CAN_RECV) return 0; // already subscribed - if (si->flags & SI_FL_WAIT_ROOM && c_size(si_ic(si))) + if (si->flags & SI_FL_RXBLK_ROOM && c_size(si_ic(si))) return 0; // already failed return si_cs_recv(cs); diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h index 3d7883e46..f63c0fd6d 100644 --- a/include/types/stream_interface.h +++ b/include/types/stream_interface.h @@ -64,7 +64,7 @@ enum { SI_FL_NONE = 0x00000000, /* nothing */ SI_FL_EXP = 0x00000001, /* timeout has expired */ SI_FL_ERR = 0x00000002, /* a non-recoverable error has occurred */ - SI_FL_WAIT_ROOM = 0x00000004, /* stream-int waits for space to store incoming data */ + SI_FL_RXBLK_ROOM = 0x00000004, /* stream-int waits for more buffer room to store incoming data */ SI_FL_WAIT_DATA = 0x00000008, /* stream-int waits for more outgoing data to send */ SI_FL_ISBACK = 0x00000010, /* 0 for front-side SI, 1 for back-side */ SI_FL_DONT_WAKE = 0x00000020, /* resync in progress, don't wake up */ diff --git a/src/applet.c b/src/applet.c index 3017bf4e1..15cc5ce43 100644 --- a/src/applet.c +++ b/src/applet.c @@ -36,14 +36,14 @@ int appctx_buf_available(void *arg) struct stream_interface *si = appctx->owner; /* allocation requested ? */ - if (!(si->flags & SI_FL_WAIT_ROOM) || c_size(si_ic(si)) || si_ic(si)->pipe) + if (!(si->flags & SI_FL_RXBLK_ROOM) || c_size(si_ic(si)) || si_ic(si)->pipe) return 0; /* allocation possible now ? */ if (!b_alloc_margin(&si_ic(si)->buf, global.tune.reserved_bufs)) return 0; - si->flags &= ~SI_FL_WAIT_ROOM; + si->flags &= ~SI_FL_RXBLK_ROOM; task_wakeup(appctx->t, TASK_WOKEN_RES); return 1; } diff --git a/src/dns.c b/src/dns.c index 90a937c04..4ceda4d1f 100644 --- a/src/dns.c +++ b/src/dns.c @@ -2030,7 +2030,7 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx) /* let's try again later from this session. We add ourselves into * this session's users so that it can remove us upon termination. */ - si->flags |= SI_FL_WAIT_ROOM; + si->flags |= SI_FL_RXBLK_ROOM; return 0; } /* fall through */ diff --git a/src/stream.c b/src/stream.c index e9270bdac..b7e1a0417 100644 --- a/src/stream.c +++ b/src/stream.c @@ -87,7 +87,7 @@ int stream_create_from_cs(struct conn_stream *cs) /* Callback used to wake up a stream when an input buffer is available. The * stream 's stream interfaces are checked for a failed buffer allocation - * as indicated by the presence of the SI_FL_WAIT_ROOM flag and the lack of a + * as indicated by the presence of the SI_FL_RXBLK_ROOM flag and the lack of a * buffer, and and input buffer is assigned there (at most one). The function * returns 1 and wakes the stream up if a buffer was taken, otherwise zero. * It's designed to be called from __offer_buffer(). @@ -96,12 +96,12 @@ int stream_buf_available(void *arg) { struct stream *s = arg; - if (!s->req.buf.size && !s->req.pipe && (s->si[0].flags & SI_FL_WAIT_ROOM) && + if (!s->req.buf.size && !s->req.pipe && (s->si[0].flags & SI_FL_RXBLK_ROOM) && b_alloc_margin(&s->req.buf, global.tune.reserved_bufs)) - s->si[0].flags &= ~SI_FL_WAIT_ROOM; - else if (!s->res.buf.size && !s->res.pipe && (s->si[1].flags & SI_FL_WAIT_ROOM) && + s->si[0].flags &= ~SI_FL_RXBLK_ROOM; + else if (!s->res.buf.size && !s->res.pipe && (s->si[1].flags & SI_FL_RXBLK_ROOM) && b_alloc_margin(&s->res.buf, 0)) - s->si[1].flags &= ~SI_FL_WAIT_ROOM; + s->si[1].flags &= ~SI_FL_RXBLK_ROOM; else return 0; diff --git a/src/stream_interface.c b/src/stream_interface.c index 26061d973..a4bbca51c 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -225,7 +225,7 @@ static void stream_int_shutw(struct stream_interface *si) /* Note that none of these states may happen with applets */ si->state = SI_ST_DIS; default: - si->flags &= ~(SI_FL_WAIT_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER); + si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER); ic->flags &= ~CF_SHUTR_NOW; ic->flags |= CF_SHUTR; ic->rex = TICK_ETERNITY; @@ -248,7 +248,7 @@ static void stream_int_chk_rcv(struct stream_interface *si) if (ic->pipe) { /* stop reading */ - si->flags |= SI_FL_WAIT_ROOM; + si->flags |= SI_FL_RXBLK_ROOM; } else { /* (re)start reading */ @@ -438,7 +438,7 @@ static int si_idle_conn_wake_cb(struct conn_stream *cs) * layers (applets, connections) after I/O completion. After updating the stream * interface and timeouts, it will try to forward what can be forwarded, then to * wake the associated task up if an important event requires special handling. - * It may update SI_FL_WAIT_DATA and/or SI_FL_WAIT_ROOM, that the callers are + * It may update SI_FL_WAIT_DATA and/or SI_FL_RXBLK_ROOM, that the callers are * encouraged to watch to take appropriate action. * It should not be called from within the stream itself, stream_int_update() * is designed for this. @@ -478,10 +478,10 @@ void stream_int_notify(struct stream_interface *si) ic->rex = tick_add_ifset(now_ms, ic->rto); } - if ((si_opposite(si)->flags & SI_FL_WAIT_ROOM) && + if ((si_opposite(si)->flags & SI_FL_RXBLK_ROOM) && ((oc->flags & (CF_SHUTW|CF_WRITE_PARTIAL|CF_DONT_READ)) == CF_WRITE_PARTIAL || channel_is_empty(oc))) { - si_opposite(si)->flags &= ~SI_FL_WAIT_ROOM; + si_opposite(si)->flags &= ~SI_FL_RXBLK_ROOM; si_chk_rcv(si_opposite(si)); } @@ -490,7 +490,7 @@ void stream_int_notify(struct stream_interface *si) * are output data, but we avoid doing this if some of the data are * not yet scheduled for being forwarded, because it is very likely * that it will be done again immediately afterwards once the following - * data are parsed (eg: HTTP chunking). We only SI_FL_WAIT_ROOM once + * data are parsed (eg: HTTP chunking). We only SI_FL_RXBLK_ROOM once * we've emptied *some* of the output buffer, and not just when there * is available room, because applets are often forced to stop before * the buffer is full. We must not stop based on input data alone because @@ -515,12 +515,12 @@ void stream_int_notify(struct stream_interface *si) * buffer or in the pipe. */ if (new_len < last_len) { - si->flags &= ~SI_FL_WAIT_ROOM; + si->flags &= ~SI_FL_RXBLK_ROOM; si_chk_rcv(si); } } - if (si->flags & SI_FL_WAIT_ROOM) { + if (si->flags & SI_FL_RXBLK_ROOM) { ic->rex = TICK_ETERNITY; } else if ((ic->flags & (CF_SHUTR|CF_READ_PARTIAL|CF_DONT_READ)) == CF_READ_PARTIAL) { @@ -760,7 +760,7 @@ void stream_int_update(struct stream_interface *si) * 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. */ - si->flags &= ~SI_FL_WAIT_ROOM; + si->flags &= ~SI_FL_RXBLK_ROOM; si_chk_rcv(si); if (!(ic->flags & (CF_READ_NOEXP|CF_DONT_READ)) && !tick_isset(ic->rex)) ic->rex = tick_add_ifset(now_ms, ic->rto); @@ -830,7 +830,7 @@ void si_update_both(struct stream_interface *si_f, struct stream_interface *si_b !(cs->flags & CS_FL_ERROR) && !(cs->conn->flags & CO_FL_ERROR)) { if (si_cs_send(cs)) - si_b->flags &= ~SI_FL_WAIT_ROOM; + si_b->flags &= ~SI_FL_RXBLK_ROOM; } /* back stream-int */ @@ -842,7 +842,7 @@ void si_update_both(struct stream_interface *si_f, struct stream_interface *si_b !(cs->flags & CS_FL_ERROR) && !(cs->conn->flags & CO_FL_ERROR)) { if (si_cs_send(cs)) - si_f->flags &= ~SI_FL_WAIT_ROOM; + si_f->flags &= ~SI_FL_RXBLK_ROOM; } /* it's time to try to receive */ @@ -860,12 +860,12 @@ void si_update_both(struct stream_interface *si_f, struct stream_interface *si_b * handled at the latest moment. */ if (obj_type(si_f->end) == OBJ_TYPE_APPCTX && - (((si_f->flags & (SI_FL_WANT_PUT|SI_FL_WAIT_ROOM)) == SI_FL_WANT_PUT) || + (((si_f->flags & (SI_FL_WANT_PUT|SI_FL_RXBLK_ROOM)) == SI_FL_WANT_PUT) || ((si_f->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET))) appctx_wakeup(si_appctx(si_f)); if (obj_type(si_b->end) == OBJ_TYPE_APPCTX && - (((si_b->flags & (SI_FL_WANT_PUT|SI_FL_WAIT_ROOM)) == SI_FL_WANT_PUT) || + (((si_b->flags & (SI_FL_WANT_PUT|SI_FL_RXBLK_ROOM)) == SI_FL_WANT_PUT) || ((si_b->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET))) appctx_wakeup(si_appctx(si_b)); } @@ -983,7 +983,7 @@ static void stream_int_shutw_conn(struct stream_interface *si) si->state = SI_ST_DIS; /* fall through */ default: - si->flags &= ~(SI_FL_WAIT_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER); + si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER); ic->flags &= ~CF_SHUTR_NOW; ic->flags |= CF_SHUTR; ic->rex = TICK_ETERNITY; @@ -1288,7 +1288,7 @@ int si_cs_recv(struct conn_stream *cs) /* if we are waiting for more space, don't try to read more data * right now. */ - if (si->flags & SI_FL_WAIT_ROOM) + if (si->flags & SI_FL_RXBLK_ROOM) break; } /* while !flags */ @@ -1341,10 +1341,10 @@ int si_cs_recv(struct conn_stream *cs) goto out_shutdown_r; /* Subscribe to receive events */ - if (!(si->flags & SI_FL_WAIT_ROOM)) + if (!(si->flags & SI_FL_RXBLK_ROOM)) conn->mux->subscribe(cs, SUB_CAN_RECV, &si->wait_event); - return (cur_read != 0 || (si->flags & SI_FL_WAIT_ROOM)); + return (cur_read != 0 || (si->flags & SI_FL_RXBLK_ROOM)); out_shutdown_r: /* we received a shutdown */ @@ -1428,7 +1428,7 @@ void si_applet_wake_cb(struct stream_interface *si) * we may have to wakeup the appctx immediately. */ if (!task_in_rq(si_task(si)) && - (((si->flags & (SI_FL_WANT_PUT|SI_FL_WAIT_ROOM)) == SI_FL_WANT_PUT) || + (((si->flags & (SI_FL_WANT_PUT|SI_FL_RXBLK_ROOM)) == SI_FL_WANT_PUT) || ((si->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET))) appctx_wakeup(si_appctx(si)); } @@ -1516,7 +1516,7 @@ static void stream_int_shutw_applet(struct stream_interface *si) si_applet_release(si); si->state = SI_ST_DIS; default: - si->flags &= ~(SI_FL_WAIT_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER); + si->flags &= ~(SI_FL_RXBLK_ROOM | SI_FL_WANT_PUT | SI_FL_NOLINGER); ic->flags &= ~CF_SHUTR_NOW; ic->flags |= CF_SHUTR; ic->rex = TICK_ETERNITY;