From: Willy Tarreau Date: Sun, 5 Apr 2015 16:15:59 +0000 (+0200) Subject: MEDIUM: frontend: move some remaining stream settings to stream_new() X-Git-Tag: v1.6-dev2~228 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c8815efb06b69c3965c115d00d0e35bf0ba1120f;p=thirdparty%2Fhaproxy.git MEDIUM: frontend: move some remaining stream settings to stream_new() The auto-forwarding mechanism in case no analyser is set is generic to the streams. Also the timeouts on the client side are better preset in the stream initialization as well. --- diff --git a/src/frontend.c b/src/frontend.c index 723ec41449..e8531e9ffe 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -141,15 +141,6 @@ int frontend_accept(struct stream *s) if (fe->mode == PR_MODE_HTTP) s->req.flags |= CF_READ_DONTWAIT; /* one read is usually enough */ - /* note: this should not happen anymore since there's always at least the switching rules */ - if (!s->req.analysers) { - channel_auto_connect(&s->req); /* don't wait to establish connection */ - channel_auto_close(&s->req); /* let the producer forward close requests */ - } - - s->req.rto = fe->timeout.client; - s->res.wto = fe->timeout.client; - /* everything's OK, let's go on */ return 1; diff --git a/src/stream.c b/src/stream.c index 59d1d5de3c..b28dff7a2c 100644 --- a/src/stream.c +++ b/src/stream.c @@ -191,8 +191,13 @@ struct stream *stream_new(struct session *sess, struct task *t) /* activate default analysers enabled for this listener */ s->req.analysers = l->analysers; + if (!s->req.analysers) { + channel_auto_connect(&s->req); /* don't wait to establish connection */ + channel_auto_close(&s->req); /* let the producer forward close requests */ + } + + s->req.rto = sess->fe->timeout.client; s->req.wto = TICK_ETERNITY; - s->req.rto = TICK_ETERNITY; s->req.rex = TICK_ETERNITY; s->req.wex = TICK_ETERNITY; s->req.analyse_exp = TICK_ETERNITY; @@ -206,8 +211,8 @@ struct stream *stream_new(struct session *sess, struct task *t) s->res.flags |= CF_NEVER_WAIT; } + s->res.wto = sess->fe->timeout.client; s->res.rto = TICK_ETERNITY; - s->res.wto = TICK_ETERNITY; s->res.rex = TICK_ETERNITY; s->res.wex = TICK_ETERNITY; s->res.analyse_exp = TICK_ETERNITY;