]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int: Be sure to have a mux to do sends and receives
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 30 Jul 2020 07:26:46 +0000 (09:26 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 30 Jul 2020 07:39:20 +0000 (09:39 +0200)
In si_cs_send() and si_cs_recv(), we explicitly test the connection's mux is
defined to proceed. For si_cs_recv(), it is probably a bit overkill. But
opportunistic sends are possible from the moment the server connection is
created. So it is safer to do this test.

This patch may be backported as far as 1.9 if necessary.

src/stream_interface.c

index 2c8f11378ab36a5b451faeab7fa668612a8c1670..a6be2c9a0ac2cb9f6891dc7d643ccca13129b35c 100644 (file)
@@ -661,6 +661,10 @@ int si_cs_send(struct conn_stream *cs)
        if (oc->flags & CF_SHUTW)
                return 1;
 
+       /* we must wait because the mux is not installed yet */
+       if (!conn->mux)
+               return 0;
+
        if (oc->pipe && conn->xprt->snd_pipe && conn->mux->snd_pipe) {
                ret = conn->mux->snd_pipe(cs, oc->pipe);
                if (ret > 0)
@@ -1220,6 +1224,10 @@ int si_cs_recv(struct conn_stream *cs)
        if (ic->flags & CF_SHUTR)
                return 1;
 
+       /* we must wait because the mux is not installed yet */
+       if (!conn->mux)
+               return 0;
+
        /* stop here if we reached the end of data */
        if (cs->flags & CS_FL_EOS)
                goto end_recv;