From: Willy Tarreau Date: Fri, 25 Oct 2013 16:41:10 +0000 (+0200) Subject: MEDIUM: session: detect applets from the session by using s->target X-Git-Tag: v1.5-dev20~130 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7584b27956df8ea9a5920ac271799b1b78390620;p=thirdparty%2Fhaproxy.git MEDIUM: session: detect applets from the session by using s->target 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. --- diff --git a/src/session.c b/src/session.c index ccdd90a24a..8dd6d05b9a 100644 --- a/src/session.c +++ b/src/session.c @@ -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;