diff --git a/src/session.c b/src/session.c index 604bfa97c..714d15ccf 100644 --- a/src/session.c +++ b/src/session.c @@ -251,6 +251,13 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr /* OK let's complete stream initialization since there is no handshake */ cli_conn->flags |= CO_FL_CONNECTED; + /* we want the connection handler to notify the stream interface about updates. */ + cli_conn->flags |= CO_FL_WAKE_DATA; + + /* if logs require transport layer information, note it on the connection */ + if (sess->fe->to_log & LW_XPRT) + cli_conn->flags |= CO_FL_XPRT_TRACKED; + session_count_new(sess); strm = stream_new(sess, t); if (!strm) @@ -408,6 +415,13 @@ static int conn_complete_session(struct connection *conn) if (conn->flags & CO_FL_ERROR) goto fail; + /* we want the connection handler to notify the stream interface about updates. */ + conn->flags |= CO_FL_WAKE_DATA; + + /* if logs require transport layer information, note it on the connection */ + if (sess->fe->to_log & LW_XPRT) + conn->flags |= CO_FL_XPRT_TRACKED; + session_count_new(sess); task->process = sess->listener->handler; strm = stream_new(sess, task); @@ -417,6 +431,7 @@ static int conn_complete_session(struct connection *conn) strm->target = sess->listener->default_target; strm->req.analysers = sess->listener->analysers; conn->flags &= ~CO_FL_INIT_DATA; + return 0; fail: diff --git a/src/stream.c b/src/stream.c index 9663747e1..ea24f9f42 100644 --- a/src/stream.c +++ b/src/stream.c @@ -204,15 +204,6 @@ struct stream *stream_new(struct session *sess, struct task *t) if (sess->fe->accept && sess->fe->accept(s) < 0) goto out_fail_accept; - if (conn) { - /* if logs require transport layer information, note it on the connection */ - if (s->logs.logwait & LW_XPRT) - conn->flags |= CO_FL_XPRT_TRACKED; - - /* we want the connection handler to notify the stream interface about updates. */ - conn->flags |= CO_FL_WAKE_DATA; - } - /* it is important not to call the wakeup function directly but to * pass through task_wakeup(), because this one knows how to apply * priorities to tasks.