]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int/conn-stream: Move si_sync_recv/send() in conn-stream scope
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 1 Apr 2022 15:03:14 +0000 (17:03 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Apr 2022 13:10:15 +0000 (15:10 +0200)
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.

include/haproxy/stream_interface.h
src/stream.c
src/stream_interface.c

index 6552713f2df899f985bf4d122a05f44afca48706..63e55ff26b29cba51b97517d9f12e892cc0ba21f 100644 (file)
@@ -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.
index 04f7ffe73346f1c4413fd15e7478562b1317363a..b860945e9bf095ff184784ae662e48a99e507d78 100644 (file)
@@ -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
index 42605652c3bf7fc65318c4d12e6ea5b14bd040a1..32b0d291909a571608cda3cc2d17d066b176fa4e 100644 (file)
@@ -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);
 }
 
 /*