mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-05 03:29:35 +00:00
REORG: channel: Rename CF_WRITE_NULL to CF_WRITE_EVENT
As for CF_READ_NULL, it appears CF_WRITE_NULL and other write events on a channel are mainly used to wake up the stream and may be replace by on write event. In this patch, we introduce CF_WRITE_EVENT flag as a replacement to CF_WRITE_EVENT_NULL. There is no breaking change for now, it is just a rename. Gradually, other write events will be merged with this one.
This commit is contained in:
parent
6e1bbc446b
commit
b96f2aa380
@ -31,7 +31,7 @@
|
||||
*
|
||||
* - pure status flags, reported by the data layer, which must be cleared
|
||||
* before doing further I/O :
|
||||
* CF_*_NULL, CF_*_PARTIAL
|
||||
* CF_*_EVENT, CF_*_PARTIAL
|
||||
*
|
||||
* - pure status flags, reported by stream connector layer, which must also
|
||||
* be cleared before doing further I/O :
|
||||
@ -64,11 +64,11 @@
|
||||
#define CF_SHUTR_NOW 0x00000040 /* the producer must shut down for reads ASAP */
|
||||
#define CF_READ_NOEXP 0x00000080 /* producer should not expire */
|
||||
|
||||
#define CF_WRITE_NULL 0x00000100 /* write(0) or connect() succeeded on consumer side */
|
||||
#define CF_WRITE_EVENT 0x00000100 /* a write event detected on consumer side */
|
||||
#define CF_WRITE_PARTIAL 0x00000200 /* some data were written to the consumer */
|
||||
#define CF_WRITE_TIMEOUT 0x00000400 /* timeout while waiting for consumer */
|
||||
#define CF_WRITE_ERROR 0x00000800 /* unrecoverable error on consumer side */
|
||||
#define CF_WRITE_ACTIVITY (CF_WRITE_NULL|CF_WRITE_PARTIAL|CF_WRITE_ERROR)
|
||||
#define CF_WRITE_ACTIVITY (CF_WRITE_EVENT|CF_WRITE_PARTIAL|CF_WRITE_ERROR)
|
||||
|
||||
#define CF_WAKE_WRITE 0x00001000 /* wake the task up when there's write activity */
|
||||
#define CF_SHUTW 0x00002000 /* consumer has already shut down */
|
||||
@ -139,7 +139,7 @@ static forceinline char *chn_show_flags(char *buf, size_t len, const char *delim
|
||||
_(0);
|
||||
/* flags */
|
||||
_(CF_READ_EVENT, _(CF_READ_PARTIAL, _(CF_READ_TIMEOUT, _(CF_READ_ERROR,
|
||||
_(CF_SHUTR, _(CF_SHUTR_NOW, _(CF_READ_NOEXP, _(CF_WRITE_NULL,
|
||||
_(CF_SHUTR, _(CF_SHUTR_NOW, _(CF_READ_NOEXP, _(CF_WRITE_EVENT,
|
||||
_(CF_WRITE_PARTIAL, _(CF_WRITE_TIMEOUT, _(CF_WRITE_ERROR,
|
||||
_(CF_WAKE_WRITE, _(CF_SHUTW, _(CF_SHUTW_NOW, _(CF_AUTO_CLOSE,
|
||||
_(CF_STREAMER, _(CF_STREAMER_FAST, _(CF_WROTE_DATA, _(CF_ANA_TIMEOUT,
|
||||
|
@ -1836,7 +1836,7 @@ skip_reuse:
|
||||
if (!sc_state_in(s->scb->state, SC_SB_EST|SC_SB_DIS|SC_SB_CLO) &&
|
||||
(srv_conn->flags & CO_FL_WAIT_XPRT) == 0) {
|
||||
s->conn_exp = TICK_ETERNITY;
|
||||
sc_oc(s->scb)->flags |= CF_WRITE_NULL;
|
||||
sc_oc(s->scb)->flags |= CF_WRITE_EVENT;
|
||||
if (s->scb->state == SC_ST_CON)
|
||||
s->scb->state = SC_ST_RDY;
|
||||
}
|
||||
|
10
src/stconn.c
10
src/stconn.c
@ -850,7 +850,7 @@ static void sc_app_chk_snd_conn(struct stconn *sc)
|
||||
/* in case of special condition (error, shutdown, end of write...), we
|
||||
* have to notify the task.
|
||||
*/
|
||||
if (likely((oc->flags & (CF_WRITE_NULL|CF_WRITE_ERROR|CF_SHUTW)) ||
|
||||
if (likely((oc->flags & (CF_WRITE_EVENT|CF_WRITE_ERROR|CF_SHUTW)) ||
|
||||
((oc->flags & CF_WAKE_WRITE) &&
|
||||
((channel_is_empty(oc) && !oc->to_forward) ||
|
||||
!sc_state_in(sc->state, SC_SB_EST))))) {
|
||||
@ -1201,7 +1201,7 @@ static void sc_notify(struct stconn *sc)
|
||||
((ic->flags & CF_EOI) || !ic->to_forward || sco->state != SC_ST_EST)) ||
|
||||
|
||||
/* changes on the consumption side */
|
||||
(oc->flags & (CF_WRITE_NULL|CF_WRITE_ERROR)) ||
|
||||
(oc->flags & (CF_WRITE_EVENT|CF_WRITE_ERROR)) ||
|
||||
((oc->flags & CF_WRITE_ACTIVITY) &&
|
||||
((oc->flags & CF_SHUTW) ||
|
||||
(((oc->flags & CF_WAKE_WRITE) ||
|
||||
@ -1776,7 +1776,7 @@ static int sc_conn_send(struct stconn *sc)
|
||||
return did_send;
|
||||
}
|
||||
|
||||
/* perform a synchronous send() for the stream connector. The CF_WRITE_NULL and
|
||||
/* perform a synchronous send() for the stream connector. The CF_WRITE_EVENT and
|
||||
* CF_WRITE_PARTIAL flags are cleared prior to the attempt, and will possibly
|
||||
* be updated in case of success.
|
||||
*/
|
||||
@ -1784,7 +1784,7 @@ void sc_conn_sync_send(struct stconn *sc)
|
||||
{
|
||||
struct channel *oc = sc_oc(sc);
|
||||
|
||||
oc->flags &= ~(CF_WRITE_NULL|CF_WRITE_PARTIAL);
|
||||
oc->flags &= ~(CF_WRITE_EVENT|CF_WRITE_PARTIAL);
|
||||
|
||||
if (oc->flags & CF_SHUTW)
|
||||
return;
|
||||
@ -1852,7 +1852,7 @@ static int sc_conn_process(struct stconn *sc)
|
||||
(conn->flags & CO_FL_WAIT_XPRT) == 0) {
|
||||
if (sc->flags & SC_FL_ISBACK)
|
||||
__sc_strm(sc)->conn_exp = TICK_ETERNITY;
|
||||
oc->flags |= CF_WRITE_NULL;
|
||||
oc->flags |= CF_WRITE_EVENT;
|
||||
if (sc->state == SC_ST_CON)
|
||||
sc->state = SC_ST_RDY;
|
||||
}
|
||||
|
@ -1553,8 +1553,8 @@ static void stream_update_both_sc(struct stream *s)
|
||||
struct channel *req = &s->req;
|
||||
struct channel *res = &s->res;
|
||||
|
||||
req->flags &= ~(CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_NULL|CF_WRITE_PARTIAL);
|
||||
res->flags &= ~(CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_NULL|CF_WRITE_PARTIAL);
|
||||
req->flags &= ~(CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_EVENT|CF_WRITE_PARTIAL);
|
||||
res->flags &= ~(CF_READ_EVENT|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_EVENT|CF_WRITE_PARTIAL);
|
||||
|
||||
s->prev_conn_state = scb->state;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user