]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream-int: remove useless checks on CS and conn flags in si_cs_send()
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 20 Nov 2018 09:30:02 +0000 (10:30 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 20 Nov 2018 13:31:44 +0000 (14:31 +0100)
In si_cs_send(), some checks are done the CS flags en the connection flags
before calling snd_buf(). But these checks are useless because they have already
been done earlier in the function. The harder to figure out is the flag
CO_FL_SOCK_WR_SH. So it is now tested with CF_SHUTW at the beginning.

src/stream_interface.c

index ca138cbef02f294a29631941f2e9f5f61d54b8aa..78c0c6ad47c466835f60f8d61ca62783f50ec1d8 100644 (file)
@@ -609,7 +609,7 @@ int si_cs_send(struct conn_stream *cs)
        }
 
        /* we might have been called just after an asynchronous shutw */
-       if (si_oc(si)->flags & CF_SHUTW)
+       if (conn->flags & CO_FL_SOCK_WR_SH || oc->flags & CF_SHUTW)
                return 1;
 
        if (oc->pipe && conn->xprt->snd_pipe && conn->mux->snd_pipe) {
@@ -634,14 +634,11 @@ int si_cs_send(struct conn_stream *cs)
        /* At this point, the pipe is empty, but we may still have data pending
         * in the normal buffer.
         */
-       if (!co_data(oc))
-               goto end;
+       if (co_data(oc)) {
+               /* when we're here, we already know that there is no spliced
+                * data left, and that there are sendable buffered data.
+                */
 
-       /* when we're here, we already know that there is no spliced
-        * data left, and that there are sendable buffered data.
-        */
-       if (!(conn->flags & (CO_FL_ERROR | CO_FL_SOCK_WR_SH | CO_FL_HANDSHAKE)) &&
-           !(cs->flags & CS_FL_ERROR) && !(oc->flags & CF_SHUTW)) {
                /* check if we want to inform the kernel that we're interested in
                 * sending more data after this call. We want this if :
                 *  - we're about to close after this last send and want to merge
@@ -685,6 +682,7 @@ int si_cs_send(struct conn_stream *cs)
                if (conn->flags & CO_FL_ERROR || cs->flags & CS_FL_ERROR)
                        return 1;
        }
+
  end:
        /* We couldn't send all of our data, let the mux know we'd like to send more */
        if (!channel_is_empty(oc))