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 ccdd90a..8dd6d05 100644
--- a/src/session.c
+++ b/src/session.c
@@ -2175,8 +2175,7 @@
*/
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;