mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-24 20:08:01 +00:00
MAJOR: session: check for a connection to an applet in sess_prepare_conn_req()
Instead of having applets bypass the whole connection process, we now follow the common path through sess_prepare_conn_req(). It is this function which detects an applet an sets the output state so SI_ST_EST instead of initiating a connection to a server. It is made possible because we now have s->target pointing to the applet.
This commit is contained in:
parent
7584b27956
commit
d84fb5e60f
@ -1151,9 +1151,10 @@ static void sess_set_term_flags(struct session *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This function initiates a server connection request on a stream interface
|
/* This function initiates a server connection request on a stream interface
|
||||||
* already in SI_ST_REQ state. Upon success, the state goes to SI_ST_ASS,
|
* already in SI_ST_REQ state. Upon success, the state goes to SI_ST_ASS for
|
||||||
* indicating that a server has been assigned. It may also return SI_ST_QUE,
|
* a real connection to a server, indicating that a server has been assigned,
|
||||||
* or SI_ST_CLO upon error.
|
* or SI_ST_EST for a successful connection to an applet. It may also return
|
||||||
|
* SI_ST_QUE, or SI_ST_CLO upon error.
|
||||||
*/
|
*/
|
||||||
static void sess_prepare_conn_req(struct session *s, struct stream_interface *si)
|
static void sess_prepare_conn_req(struct session *s, struct stream_interface *si)
|
||||||
{
|
{
|
||||||
@ -1168,6 +1169,18 @@ static void sess_prepare_conn_req(struct session *s, struct stream_interface *si
|
|||||||
if (si->state != SI_ST_REQ)
|
if (si->state != SI_ST_REQ)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (unlikely(obj_type(s->target) == OBJ_TYPE_APPLET)) {
|
||||||
|
/* the applet directly goes to the EST state */
|
||||||
|
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
||||||
|
s->logs.t_connect = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
||||||
|
si->state = SI_ST_EST;
|
||||||
|
si->err_type = SI_ET_NONE;
|
||||||
|
si->exp = TICK_ETERNITY;
|
||||||
|
s->req->wex = TICK_ETERNITY;
|
||||||
|
s->rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Try to assign a server */
|
/* Try to assign a server */
|
||||||
if (srv_redispatch_connect(s) != 0) {
|
if (srv_redispatch_connect(s) != 0) {
|
||||||
/* We did not get a server. Either we queued the
|
/* We did not get a server. Either we queued the
|
||||||
@ -2175,11 +2188,6 @@ struct task *process_session(struct task *t)
|
|||||||
*/
|
*/
|
||||||
s->req->cons->state = SI_ST_REQ; /* new connection requested */
|
s->req->cons->state = SI_ST_REQ; /* new connection requested */
|
||||||
s->req->cons->conn_retries = s->be->conn_retries;
|
s->req->cons->conn_retries = s->be->conn_retries;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2207,7 +2215,7 @@ struct task *process_session(struct task *t)
|
|||||||
/* check for HTTP mode and proxy server_name_hdr_name != NULL */
|
/* check for HTTP mode and proxy server_name_hdr_name != NULL */
|
||||||
if ((s->flags & SN_BE_ASSIGNED) &&
|
if ((s->flags & SN_BE_ASSIGNED) &&
|
||||||
(s->be->mode == PR_MODE_HTTP) &&
|
(s->be->mode == PR_MODE_HTTP) &&
|
||||||
(s->be->server_id_hdr_name != NULL && s->target)) {
|
(s->be->server_id_hdr_name != NULL && objt_server(s->target))) {
|
||||||
http_send_name_header(&s->txn, s->be, objt_server(s->target)->id);
|
http_send_name_header(&s->txn, s->be, objt_server(s->target)->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user