From: Frederic Lecaille Date: Thu, 19 Mar 2026 13:52:39 +0000 (+0100) Subject: MINOR: stconn: add sc_hastream() and __sc_hastream() helpers X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=e08b126fbbb267c508900d8ac130d4d76f15ef3c;p=haproxy.git MINOR: stconn: add sc_hastream() and __sc_hastream() helpers This patch introduces the sc_hastream() and __sc_hastream() inline helpers to retrieve a haload stream context (struct hastream) from a stream connector. These functions allow the stconn layer to safely access haload-specific stream data when the application type is OBJ_TYPE_HXLOAD. --- diff --git a/include/haproxy/stconn.h b/include/haproxy/stconn.h index 68146b999..7c6d3b553 100644 --- a/include/haproxy/stconn.h +++ b/include/haproxy/stconn.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -350,6 +351,21 @@ static inline struct hstream *sc_hstream(const struct stconn *sc) return NULL; } +/* Returns the haload stream from a sc if the application is a + * haload stream. Otherwise NULL is returned. __sc_hldstream() returns the haterm + * stream without any control while sc_hldstream() check the application type. + */ +static inline struct hldstream *__sc_hldstream(const struct stconn *sc) +{ + return __objt_hldstream(sc->app); +} +static inline struct hldstream *sc_hldstream(const struct stconn *sc) +{ + if (obj_type(sc->app) == OBJ_TYPE_HALOAD) + return __objt_hldstream(sc->app); + return NULL; +} + /* Returns non-zero if the stream connector's Rx path is blocked because of * lack of room in the input buffer. This usually happens after applets failed * to deliver data into the channel's buffer and reported it via sc_need_room().