MINOR: stream-int/conn-stream: Move si_conn_ready() in the conn-stream scope

si_conn_ready() is renamed cs_conn_ready() and handle a conn-stream insted
of a stream-interface. The function is now in cs_utils.h.
This commit is contained in:
Christopher Faulet 2022-03-31 09:58:41 +02:00
parent 0a4dcb65ff
commit e39a4dfdf0
3 changed files with 12 additions and 11 deletions

View File

@ -108,6 +108,17 @@ static inline int cs_state_in(enum cs_state state, enum cs_state_bit mask)
return !!(cs_state_bit(state) & mask); return !!(cs_state_bit(state) & mask);
} }
/* Returns true if a connection is attached to the conn-stream <cs> and if this
* connection is ready.
*/
static inline int cs_conn_ready(struct conn_stream *cs)
{
struct connection *conn = cs_conn(cs);
return conn && conn_ctrl_ready(conn) && conn_xprt_ready(conn);
}
/* Returns the source address of the conn-stream and, if not set, fallbacks on /* Returns the source address of the conn-stream and, if not set, fallbacks on
* the session for frontend CS and the server connection for the backend CS. It * the session for frontend CS and the server connection for the backend CS. It
* returns a const address on success or NULL on failure. * returns a const address on success or NULL on failure.

View File

@ -127,16 +127,6 @@ static inline void si_applet_release(struct stream_interface *si)
appctx->applet->release(appctx); appctx->applet->release(appctx);
} }
/* Returns true if a connection is attached to the stream interface <si> and
* if this connection is ready.
*/
static inline int si_conn_ready(struct stream_interface *si)
{
struct connection *conn = cs_conn(si->cs);
return conn && conn_ctrl_ready(conn) && conn_xprt_ready(conn);
}
/* Returns non-zero if the stream interface's Rx path is blocked */ /* Returns non-zero if the stream interface's Rx path is blocked */
static inline int si_rx_blocked(const struct stream_interface *si) static inline int si_rx_blocked(const struct stream_interface *si)
{ {

View File

@ -2753,7 +2753,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
/* only release our endpoint if we don't intend to reuse the /* only release our endpoint if we don't intend to reuse the
* connection. * connection.
*/ */
if (!si_conn_ready(cs_si(s->csb))) { if (!cs_conn_ready(s->csb)) {
s->srv_conn = NULL; s->srv_conn = NULL;
if (cs_reset_endp(s->csb) < 0) { if (cs_reset_endp(s->csb) < 0) {
if (!s->conn_err_type) if (!s->conn_err_type)