mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-05 03:29:35 +00: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);
|
||||
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) */
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/* 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 */
|
||||
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)
|
||||
{
|
||||
if (!(__sc_appctx(sc)->flags & APPCTX_FL_INOUT_BUFS))
|
||||
return 0;
|
||||
|
||||
if (!sc_state_in(sc->state, SC_SB_RDY|SC_SB_EST))
|
||||
return 0;
|
||||
|
||||
@ -2198,6 +2201,9 @@ void sc_applet_sync_send(struct stconn *sc)
|
||||
|
||||
oc->flags &= ~CF_WRITE_EVENT;
|
||||
|
||||
if (!(__sc_appctx(sc)->flags & APPCTX_FL_INOUT_BUFS))
|
||||
return;
|
||||
|
||||
if (sc->flags & SC_FL_SHUT_DONE)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user