]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int: Always access the stream-int via the conn-stream
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 23 Dec 2021 14:15:22 +0000 (15:15 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 24 Feb 2022 10:00:02 +0000 (11:00 +0100)
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the stream-interface part.

include/haproxy/stream_interface.h

index 6da05bcb54a581d4b67945e1fa9a3bb74f860af1..c5fd3931179446dafc92b28b0dd8c77452ddf2a5 100644 (file)
@@ -51,19 +51,13 @@ void si_sync_send(struct stream_interface *si);
 /* returns the channel which receives data from this stream interface (input channel) */
 static inline struct channel *si_ic(struct stream_interface *si)
 {
-       if (si->flags & SI_FL_ISBACK)
-               return &LIST_ELEM(si, struct stream *, si[1])->res;
-       else
-               return &LIST_ELEM(si, struct stream *, si[0])->req;
+       return ((si->flags & SI_FL_ISBACK) ? &(cs_strm(si->cs)->res) : &(cs_strm(si->cs)->req));
 }
 
 /* returns the channel which feeds data to this stream interface (output channel) */
 static inline struct channel *si_oc(struct stream_interface *si)
 {
-       if (si->flags & SI_FL_ISBACK)
-               return &LIST_ELEM(si, struct stream *, si[1])->req;
-       else
-               return &LIST_ELEM(si, struct stream *, si[0])->res;
+       return ((si->flags & SI_FL_ISBACK) ? &(cs_strm(si->cs)->req) : &(cs_strm(si->cs)->res));
 }
 
 /* returns the buffer which receives data from this stream interface (input channel's buffer) */
@@ -81,28 +75,19 @@ static inline struct buffer *si_ob(struct stream_interface *si)
 /* returns the stream associated to a stream interface */
 static inline struct stream *si_strm(struct stream_interface *si)
 {
-       if (si->flags & SI_FL_ISBACK)
-               return LIST_ELEM(si, struct stream *, si[1]);
-       else
-               return LIST_ELEM(si, struct stream *, si[0]);
+       return cs_strm(si->cs);
 }
 
 /* returns the task associated to this stream interface */
 static inline struct task *si_task(struct stream_interface *si)
 {
-       if (si->flags & SI_FL_ISBACK)
-               return LIST_ELEM(si, struct stream *, si[1])->task;
-       else
-               return LIST_ELEM(si, struct stream *, si[0])->task;
+       return cs_strm(si->cs)->task;
 }
 
 /* returns the stream interface on the other side. Used during forwarding. */
 static inline struct stream_interface *si_opposite(struct stream_interface *si)
 {
-       if (si->flags & SI_FL_ISBACK)
-               return &LIST_ELEM(si, struct stream *, si[1])->si[0];
-       else
-               return &LIST_ELEM(si, struct stream *, si[0])->si[1];
+       return ((si->flags & SI_FL_ISBACK) ? &(cs_strm(si->cs)->si[0]) : &(cs_strm(si->cs)->si[1]));
 }
 
 /* initializes a stream interface in the SI_ST_INI state. It's detached from