From: Christopher Faulet Date: Fri, 1 Apr 2022 15:03:14 +0000 (+0200) Subject: MINOR: stream-int/conn-stream: Move si_sync_recv/send() in conn-stream scope X-Git-Tag: v2.6-dev6~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=431ce2e3c1d97585950fb38a517430b08b250120;p=thirdparty%2Fhaproxy.git MINOR: stream-int/conn-stream: Move si_sync_recv/send() in conn-stream scope si_sync_recv() and si_sync_send() are renamesd cs_conn_recv() and cs_conn_send() and updated to manipulate conn-streams instead of stream-interfaces. --- diff --git a/include/haproxy/stream_interface.h b/include/haproxy/stream_interface.h index 6552713f2d..63e55ff26b 100644 --- a/include/haproxy/stream_interface.h +++ b/include/haproxy/stream_interface.h @@ -39,8 +39,8 @@ void si_free(struct stream_interface *si); /* main event functions used to move data between sockets and buffers */ int cs_applet_process(struct conn_stream *cs); struct task *cs_conn_io_cb(struct task *t, void *ctx, unsigned int state); -int si_sync_recv(struct stream_interface *si); -void si_sync_send(struct stream_interface *si); +int cs_conn_sync_recv(struct conn_stream *cs); +void cs_conn_sync_send(struct conn_stream *cs); /* Functions used to communicate with a conn_stream. The first two may be used * directly, the last one is mostly a wake callback. diff --git a/src/stream.c b/src/stream.c index 04f7ffe733..b860945e9b 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1657,8 +1657,8 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) si_b = cs_si(s->csb); /* First, attempt to receive pending data from I/O layers */ - si_sync_recv(si_f); - si_sync_recv(si_b); + cs_conn_sync_recv(s->csf); + cs_conn_sync_recv(s->csb); /* Let's check if we're looping without making any progress, e.g. due * to a bogus analyser or the fact that we're ignoring a read0. The @@ -2311,7 +2311,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) } /* Let's see if we can send the pending request now */ - si_sync_send(si_b); + cs_conn_sync_send(s->csb); /* * Now forward all shutdown requests between both sides of the request buffer @@ -2438,7 +2438,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state) rpf_last = res->flags; /* Let's see if we can send the pending response now */ - si_sync_send(si_f); + cs_conn_sync_send(s->csf); /* * Now forward all shutdown requests between both sides of the buffer diff --git a/src/stream_interface.c b/src/stream_interface.c index 42605652c3..32b0d29190 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -485,30 +485,30 @@ struct task *cs_conn_io_cb(struct task *t, void *ctx, unsigned int state) * to be programmed and performed later, though it doesn't provide any * such guarantee. */ -int si_sync_recv(struct stream_interface *si) +int cs_conn_sync_recv(struct conn_stream *cs) { - if (!cs_state_in(si->cs->state, CS_SB_RDY|CS_SB_EST)) + if (!cs_state_in(cs->state, CS_SB_RDY|CS_SB_EST)) return 0; - if (!cs_conn_mux(si->cs)) + if (!cs_conn_mux(cs)) return 0; // only conn_streams are supported - if (si->cs->wait_event.events & SUB_RETRY_RECV) + if (cs->wait_event.events & SUB_RETRY_RECV) return 0; // already subscribed - if (!si_rx_endp_ready(si) || si_rx_blocked(si)) + if (!si_rx_endp_ready(cs->si) || si_rx_blocked(cs->si)) return 0; // already failed - return si_cs_recv(si->cs); + return si_cs_recv(cs); } /* perform a synchronous send() for the stream interface. The CF_WRITE_NULL and * CF_WRITE_PARTIAL flags are cleared prior to the attempt, and will possibly * be updated in case of success. */ -void si_sync_send(struct stream_interface *si) +void cs_conn_sync_send(struct conn_stream *cs) { - struct channel *oc = si_oc(si); + struct channel *oc = cs_oc(cs); oc->flags &= ~(CF_WRITE_NULL|CF_WRITE_PARTIAL); @@ -518,13 +518,13 @@ void si_sync_send(struct stream_interface *si) if (channel_is_empty(oc)) return; - if (!cs_state_in(si->cs->state, CS_SB_CON|CS_SB_RDY|CS_SB_EST)) + if (!cs_state_in(cs->state, CS_SB_CON|CS_SB_RDY|CS_SB_EST)) return; - if (!cs_conn_mux(si->cs)) + if (!cs_conn_mux(cs)) return; - si_cs_send(si->cs); + si_cs_send(cs); } /*