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.
This commit is contained in:
Christopher Faulet 2022-04-01 17:03:14 +02:00
parent 4a7764ae9d
commit 431ce2e3c1
3 changed files with 17 additions and 17 deletions

View 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.

View 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

View 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);
}
/*