]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MAJOR: stream-int: only rely on SI_FL_ISBACK to find the requested channel
authorWilly Tarreau <w@1wt.eu>
Fri, 28 Nov 2014 10:50:38 +0000 (11:50 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 11 Mar 2015 19:41:46 +0000 (20:41 +0100)
In order to plan removal of si->ib / si->ob, we now check the side of the
stream interface and find the session, then the requested channel. In
practice it's just an offset applied to the pointer based on the flag.

include/proto/stream_interface.h

index aba94c753b21051ed1fe98790cd026061d5110c0..cc79e6ddda3382c099b9b60ff5dac70e7e66c5c7 100644 (file)
@@ -49,13 +49,19 @@ void stream_int_unregister_handler(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)
 {
-       return si->ib;
+       if (si->flags & SI_FL_ISBACK)
+               return &LIST_ELEM(si, struct session *, si[1])->res;
+       else
+               return &LIST_ELEM(si, struct session *, si[0])->req;
 }
 
 /* returns the channel which feeds data to this stream interface (output channel) */
 static inline struct channel *si_oc(struct stream_interface *si)
 {
-       return si->ob;
+       if (si->flags & SI_FL_ISBACK)
+               return &LIST_ELEM(si, struct session *, si[1])->req;
+       else
+               return &LIST_ELEM(si, struct session *, si[0])->res;
 }
 
 /* Initializes all required fields for a new appctx. Note that it does the