mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
MINOR: sc_strm: Add generic version to perform sync receives and sends
sc_sync_recv() and sc_sync_send() were added to use connection or applet versions, depending on the endpoint type. For now these functions are not used. But this will be used by process_stream() to replace the connection version.
This commit is contained in:
parent
498520fdf5
commit
5056cbdb86
@ -43,6 +43,9 @@ void sc_conn_sync_send(struct stconn *sc);
|
|||||||
int sc_applet_sync_recv(struct stconn *sc);
|
int sc_applet_sync_recv(struct stconn *sc);
|
||||||
void sc_applet_sync_send(struct stconn *sc);
|
void sc_applet_sync_send(struct stconn *sc);
|
||||||
|
|
||||||
|
int sc_applet_sync_recv(struct stconn *sc);
|
||||||
|
void sc_applet_sync_send(struct stconn *sc);
|
||||||
|
|
||||||
|
|
||||||
/* returns the channel which receives data from this stream connector (input channel) */
|
/* returns the channel which receives data from this stream connector (input channel) */
|
||||||
static inline struct channel *sc_ic(const struct stconn *sc)
|
static inline struct channel *sc_ic(const struct stconn *sc)
|
||||||
@ -322,6 +325,30 @@ static inline void sc_chk_snd(struct stconn *sc)
|
|||||||
sc->app_ops->chk_snd(sc);
|
sc->app_ops->chk_snd(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Perform a synchronous receive using the right version, depending the endpoing
|
||||||
|
* is a connection or an applet.
|
||||||
|
*/
|
||||||
|
static inline int sc_sync_recv(struct stconn *sc)
|
||||||
|
{
|
||||||
|
if (sc_ep_test(sc, SE_FL_T_MUX))
|
||||||
|
return sc_conn_sync_recv(sc);
|
||||||
|
else if (sc_ep_test(sc, SE_FL_T_APPLET))
|
||||||
|
return sc_applet_sync_recv(sc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Perform a synchronous send using the right version, depending the endpoing is
|
||||||
|
* a connection or an applet.
|
||||||
|
*/
|
||||||
|
static inline void sc_sync_send(struct stconn *sc)
|
||||||
|
{
|
||||||
|
if (sc_ep_test(sc, SE_FL_T_MUX))
|
||||||
|
sc_conn_sync_send(sc);
|
||||||
|
else if (sc_ep_test(sc, SE_FL_T_APPLET))
|
||||||
|
sc_applet_sync_send(sc);
|
||||||
|
}
|
||||||
|
|
||||||
/* Combines both sc_update_rx() and sc_update_tx() at once */
|
/* Combines both sc_update_rx() and sc_update_tx() at once */
|
||||||
static inline void sc_update(struct stconn *sc)
|
static inline void sc_update(struct stconn *sc)
|
||||||
{
|
{
|
||||||
|
@ -2107,6 +2107,9 @@ int sc_applet_recv(struct stconn *sc)
|
|||||||
*/
|
*/
|
||||||
int sc_applet_sync_recv(struct stconn *sc)
|
int sc_applet_sync_recv(struct stconn *sc)
|
||||||
{
|
{
|
||||||
|
if (!(__sc_appctx(sc)->flags & APPCTX_FL_INOUT_BUFS))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!sc_state_in(sc->state, SC_SB_RDY|SC_SB_EST))
|
if (!sc_state_in(sc->state, SC_SB_RDY|SC_SB_EST))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -2198,6 +2201,9 @@ void sc_applet_sync_send(struct stconn *sc)
|
|||||||
|
|
||||||
oc->flags &= ~CF_WRITE_EVENT;
|
oc->flags &= ~CF_WRITE_EVENT;
|
||||||
|
|
||||||
|
if (!(__sc_appctx(sc)->flags & APPCTX_FL_INOUT_BUFS))
|
||||||
|
return;
|
||||||
|
|
||||||
if (sc->flags & SC_FL_SHUT_DONE)
|
if (sc->flags & SC_FL_SHUT_DONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user