]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: session: detect applets from the session by using s->target
authorWilly Tarreau <w@1wt.eu>
Fri, 25 Oct 2013 16:41:10 +0000 (18:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Dec 2013 14:40:22 +0000 (15:40 +0100)
We used to rely on the stream interface's target to detect an applet
from within the session while trying to process the connection request,
but this is incorrect, as this target is the one currently connected
and not the next one to process. This will make a difference when we
later support keep-alive. The only "official" value indicating where
we want to connect is the session's target, which can be :
  - &applet : connect to this applet
  - NULL : connect using the normal LB algos
  - anything else : direct connection to some entity

Since we're interested in detecting the specific case of applets, it's
OK to make use of s->target then.

Also, applets are being isolated from connections, and as such there
will not be any ->connect method available when an applet is running,
so we can get rid of this test as well.

src/session.c

index ccdd90a24aa761e6b6c04520fc87763ee2d02d29..8dd6d05b9a91fc36aea63ff606c470f13a5d0c57 100644 (file)
@@ -2175,8 +2175,7 @@ struct task *process_session(struct task *t)
                                 */
                                s->req->cons->state = SI_ST_REQ; /* new connection requested */
                                s->req->cons->conn_retries = s->be->conn_retries;
-                               if (unlikely(obj_type(s->req->cons->conn->target) == OBJ_TYPE_APPLET &&
-                                            !(si_ctrl(s->req->cons) && si_ctrl(s->req->cons)->connect))) {
+                               if (unlikely(obj_type(s->target) == OBJ_TYPE_APPLET)) {
                                        s->req->cons->state = SI_ST_EST; /* connection established */
                                        s->rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
                                        s->req->wex = TICK_ETERNITY;