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

si_is_conn_error() is renamed as cs_is_conn_erro() and updated to manipulate
a conn-stream instead of a stream-interface.
This commit is contained in:
Christopher Faulet 2022-04-01 17:15:10 +02:00
parent 000ba3e613
commit 158f33615d
4 changed files with 22 additions and 21 deletions

View File

@ -123,6 +123,25 @@ static inline int cs_conn_ready(struct conn_stream *cs)
}
/* The conn-stream is only responsible for the connection during the early
* states, before plugging a mux. Thus it should only care about CO_FL_ERROR
* before CS_ST_EST, and after that it must absolutely ignore it since the mux
* may hold pending data. This function returns true if such an error was
* reported. Both the CS and the CONN must be valid.
*/
static inline int cs_is_conn_error(const struct conn_stream *cs)
{
struct connection *conn;
if (cs->state >= CS_ST_EST)
return 0;
conn = __cs_conn(cs);
BUG_ON(!conn);
return !!(conn->flags & CO_FL_ERROR);
}
/* 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
* returns a const address on success or NULL on failure.

View File

@ -261,24 +261,6 @@ static inline int si_alloc_ibuf(struct stream_interface *si, struct buffer_wait
return ret;
}
/* The stream interface is only responsible for the connection during the early
* states, before plugging a mux. Thus it should only care about CO_FL_ERROR
* before CS_ST_EST, and after that it must absolutely ignore it since the mux
* may hold pending data. This function returns true if such an error was
* reported. Both the CS and the CONN must be valid.
*/
static inline int si_is_conn_error(const struct stream_interface *si)
{
struct connection *conn;
if (si->cs->state >= CS_ST_EST)
return 0;
conn = __cs_conn(si->cs);
BUG_ON(!conn);
return !!(conn->flags & CO_FL_ERROR);
}
#endif /* _HAPROXY_STREAM_INTERFACE_H */
/*

View File

@ -730,7 +730,7 @@ static void cs_app_chk_snd_conn(struct conn_stream *cs)
if (!(cs->wait_event.events & SUB_RETRY_SEND) && !channel_is_empty(cs_oc(cs)))
cs_conn_send(cs);
if (cs->endp->flags & (CS_EP_ERROR|CS_EP_ERR_PENDING) || si_is_conn_error(cs->si)) {
if (cs->endp->flags & (CS_EP_ERROR|CS_EP_ERR_PENDING) || cs_is_conn_error(cs)) {
/* Write error on the file descriptor */
if (cs->state >= CS_ST_CON)
cs->endp->flags |= CS_EP_ERROR;

View File

@ -249,7 +249,7 @@ int cs_conn_process(struct conn_stream *cs)
*/
if (cs->state >= CS_ST_CON) {
if (si_is_conn_error(cs->si))
if (cs_is_conn_error(cs))
cs->endp->flags |= CS_EP_ERROR;
}
@ -320,7 +320,7 @@ int cs_conn_send(struct conn_stream *cs)
int ret;
int did_send = 0;
if (cs->endp->flags & (CS_EP_ERROR|CS_EP_ERR_PENDING) || si_is_conn_error(cs->si)) {
if (cs->endp->flags & (CS_EP_ERROR|CS_EP_ERR_PENDING) || cs_is_conn_error(cs)) {
/* We're probably there because the tasklet was woken up,
* but process_stream() ran before, detected there were an
* error and put the si back to CS_ST_TAR. There's still