]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MAJOR: channel: only rely on the new CF_ISRESP flag to find the SI
authorWilly Tarreau <w@1wt.eu>
Fri, 28 Nov 2014 13:22:12 +0000 (14:22 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 11 Mar 2015 19:41:47 +0000 (20:41 +0100)
Now we exclusively use this flag to find what side a channel is and
where the stream ints are. The ->prod and ->cons are not used anymore.

include/proto/channel.h

index 28043f0795eacd9e71d4c1a9ed7aca47b00d5aa9..0c547dd74f22bc5e1444dd79be97b69663ea837a 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <types/channel.h>
 #include <types/global.h>
+#include <types/session.h>
 #include <types/stream_interface.h>
 
 /* perform minimal intializations, report 0 in case of error, 1 if OK. */
@@ -56,13 +57,19 @@ int bo_getblk_nc(struct channel *chn, char **blk1, int *len1, char **blk2, int *
 /* returns a pointer to the stream interface feeding the channel (producer) */
 static inline struct stream_interface *chn_prod(const struct channel *chn)
 {
-       return chn->prod;
+       if (chn->flags & CF_ISRESP)
+               return &LIST_ELEM(chn, struct session *, res)->si[1];
+       else
+               return &LIST_ELEM(chn, struct session *, req)->si[0];
 }
 
 /* returns a pointer to the stream interface consuming the channel (producer) */
 static inline struct stream_interface *chn_cons(const struct channel *chn)
 {
-       return chn->cons;
+       if (chn->flags & CF_ISRESP)
+               return &LIST_ELEM(chn, struct session *, res)->si[0];
+       else
+               return &LIST_ELEM(chn, struct session *, req)->si[1];
 }
 
 /* Initialize all fields in the channel. */