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.
diff --git a/include/haproxy/cs_utils.h b/include/haproxy/cs_utils.h
index 64b5e85..257fcd3 100644
--- a/include/haproxy/cs_utils.h
+++ b/include/haproxy/cs_utils.h
@@ -123,6 +123,25 @@
}
+/* 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.
diff --git a/include/haproxy/stream_interface.h b/include/haproxy/stream_interface.h
index 8f9c98f..5c64367 100644
--- a/include/haproxy/stream_interface.h
+++ b/include/haproxy/stream_interface.h
@@ -261,24 +261,6 @@
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 */
/*
diff --git a/src/conn_stream.c b/src/conn_stream.c
index 0a2edf1..1bfdace 100644
--- a/src/conn_stream.c
+++ b/src/conn_stream.c
@@ -730,7 +730,7 @@
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;
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 11cd339..85c9398 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -249,7 +249,7 @@
*/
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 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