mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-15 18:17:01 +00:00
MEDIUM: stream: make stream_new() always set the target and analysers
It doesn't make sense that stream_new() doesn't sets the target nor analysers and that the caller has to do it even if it doesn't know about streams (eg: in session_accept_fd()). This causes trouble for H2 where the applet handling the protocol cannot properly change these information during its init phase. Let's ensure it's always set and that the callers don't set it anymore. Note: peers and lua don't use analysers and that's properly handled.
This commit is contained in:
parent
f3a55dbd22
commit
9b82d941c5
@ -116,7 +116,6 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr
|
|||||||
struct connection *cli_conn;
|
struct connection *cli_conn;
|
||||||
struct proxy *p = l->bind_conf->frontend;
|
struct proxy *p = l->bind_conf->frontend;
|
||||||
struct session *sess;
|
struct session *sess;
|
||||||
struct stream *strm;
|
|
||||||
struct task *t;
|
struct task *t;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -269,13 +268,9 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr
|
|||||||
goto out_free_sess;
|
goto out_free_sess;
|
||||||
|
|
||||||
session_count_new(sess);
|
session_count_new(sess);
|
||||||
strm = stream_new(sess, t, &cli_conn->obj_type);
|
if (!stream_new(sess, t, &cli_conn->obj_type))
|
||||||
if (!strm)
|
|
||||||
goto out_free_task;
|
goto out_free_task;
|
||||||
|
|
||||||
strm->target = sess->listener->default_target;
|
|
||||||
strm->req.analysers |= sess->listener->analysers;
|
|
||||||
|
|
||||||
task_wakeup(t, TASK_WOKEN_INIT);
|
task_wakeup(t, TASK_WOKEN_INIT);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -424,7 +419,6 @@ static int conn_complete_session(struct connection *conn)
|
|||||||
{
|
{
|
||||||
struct task *task = conn->owner;
|
struct task *task = conn->owner;
|
||||||
struct session *sess = task->context;
|
struct session *sess = task->context;
|
||||||
struct stream *strm;
|
|
||||||
|
|
||||||
if (conn->flags & CO_FL_ERROR)
|
if (conn->flags & CO_FL_ERROR)
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -439,12 +433,9 @@ static int conn_complete_session(struct connection *conn)
|
|||||||
|
|
||||||
session_count_new(sess);
|
session_count_new(sess);
|
||||||
task->process = sess->listener->handler;
|
task->process = sess->listener->handler;
|
||||||
strm = stream_new(sess, task, &conn->obj_type);
|
if (!stream_new(sess, task, &conn->obj_type))
|
||||||
if (!strm)
|
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
strm->target = sess->listener->default_target;
|
|
||||||
strm->req.analysers |= sess->listener->analysers;
|
|
||||||
conn->flags &= ~CO_FL_INIT_DATA;
|
conn->flags &= ~CO_FL_INIT_DATA;
|
||||||
|
|
||||||
task_wakeup(task, TASK_WOKEN_INIT);
|
task_wakeup(task, TASK_WOKEN_INIT);
|
||||||
|
@ -189,7 +189,8 @@ struct stream *stream_new(struct session *sess, struct task *t, enum obj_type *o
|
|||||||
s->si[1].flags |= SI_FL_INDEP_STR;
|
s->si[1].flags |= SI_FL_INDEP_STR;
|
||||||
|
|
||||||
stream_init_srv_conn(s);
|
stream_init_srv_conn(s);
|
||||||
s->target = NULL;
|
s->target = sess->listener ? sess->listener->default_target : NULL;
|
||||||
|
|
||||||
s->pend_pos = NULL;
|
s->pend_pos = NULL;
|
||||||
|
|
||||||
/* init store persistence */
|
/* init store persistence */
|
||||||
@ -197,7 +198,7 @@ struct stream *stream_new(struct session *sess, struct task *t, enum obj_type *o
|
|||||||
|
|
||||||
channel_init(&s->req);
|
channel_init(&s->req);
|
||||||
s->req.flags |= CF_READ_ATTACHED; /* the producer is already connected */
|
s->req.flags |= CF_READ_ATTACHED; /* the producer is already connected */
|
||||||
s->req.analysers = 0;
|
s->req.analysers = sess->listener ? sess->listener->analysers : 0;
|
||||||
channel_auto_connect(&s->req); /* don't wait to establish connection */
|
channel_auto_connect(&s->req); /* don't wait to establish connection */
|
||||||
channel_auto_close(&s->req); /* let the producer forward close requests */
|
channel_auto_close(&s->req); /* let the producer forward close requests */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user