]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: servers: Don't check if we have a conn_stream too soon.
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 23 Nov 2018 13:32:08 +0000 (14:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 23 Nov 2018 13:56:21 +0000 (14:56 +0100)
The creation of the conn_stream for an outgoing connection has been delayed
a bit, and when using dispatch, a check was made to see if a conn_stream
was attached before the conn_stream was created, so remove the test, as
it's done later anyway, and create and install the conn_stream right away
when we don't have a server, as is done when we don't have an alpn/npn
defined.

src/backend.c

index 862fe3d8d35d3d9f28dc75a42182ef096d081b51..3ab450bcb147dd49694a50df2c838b336fb09ad9 100644 (file)
@@ -1253,15 +1253,16 @@ int connect_server(struct stream *s)
                else if (obj_type(s->target) == OBJ_TYPE_PROXY) {
                        /* proxies exclusively run on raw_sock right now */
                        conn_prepare(srv_conn, protocol_by_family(srv_conn->addr.to.ss_family), xprt_get(XPRT_RAW));
-                       if (!objt_cs(s->si[1].end) || !objt_cs(s->si[1].end)->conn->ctrl)
+                       if (!(srv_conn->ctrl))
                                return SF_ERR_INTERNAL;
                }
                else
                        return SF_ERR_INTERNAL;  /* how did we get there ? */
 
 #ifdef USE_OPENSSL
-               if ((!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) ||
-                   srv->mux_proto)
+               if (!srv ||
+                   ((!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) ||
+                   srv->mux_proto))
 #endif
                {
                        srv_cs = si_alloc_cs(&s->si[1], srv_conn);