BUG/MEDIUM: servers: Don't check if we have a conn_stream too soon.

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.
This commit is contained in:
Olivier Houchard 2018-11-23 14:32:08 +01:00 committed by Willy Tarreau
parent c6e0bb4944
commit 1295016873

View File

@ -1253,15 +1253,16 @@ int connect_server(struct stream *s)
else if (obj_type(s->target) == OBJ_TYPE_PROXY) { else if (obj_type(s->target) == OBJ_TYPE_PROXY) {
/* proxies exclusively run on raw_sock right now */ /* 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)); 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; return SF_ERR_INTERNAL;
} }
else else
return SF_ERR_INTERNAL; /* how did we get there ? */ return SF_ERR_INTERNAL; /* how did we get there ? */
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
if ((!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) || if (!srv ||
srv->mux_proto) ((!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) ||
srv->mux_proto))
#endif #endif
{ {
srv_cs = si_alloc_cs(&s->si[1], srv_conn); srv_cs = si_alloc_cs(&s->si[1], srv_conn);