]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: mux-h2: remove the unused "full" variable in h2_frt_transfer_data()
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Oct 2024 12:11:06 +0000 (14:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Oct 2024 14:12:46 +0000 (16:12 +0200)
During 11th and 12th iteration of the development cycle for the H2 auto
rx window, several approaches were attempted to figure if another buffer
could be allocated or not. One of them consisted in looping back to the
beginning of the function requesting a new buffer slot and getting one
if the buffer was either apparently or confirmed full. The latest one
consisted in directly allocating the next buffer from the two places
where it's found to be proven full, instead of checking with the now
defunct h2s_may_get_rxbuf() if we were allowed to get once an loop.
That approach was retained. In this case the "full" variabled is no
longer needed, so let's get rid of it because the construct looks bogus
and confuses coverity (and possibly code readers as the intent is unclear
compared to the code).

src/mux_h2.c

index 349307475f4acd80bad99fa794649ae7276c8bd2..3d0509c5d8f0323a37924aecd8ecfa9a6791fb38 100644 (file)
@@ -5982,7 +5982,6 @@ static int h2_frt_transfer_data(struct h2s *h2s)
        struct htx *htx = NULL;
        struct buffer *scbuf = NULL;
        unsigned int sent;
-       int full = 0;
 
        TRACE_ENTER(H2_EV_RX_FRAME|H2_EV_RX_DATA, h2c->conn, h2s);
 
@@ -5993,7 +5992,7 @@ static int h2_frt_transfer_data(struct h2s *h2s)
         * allocating an rxbuf if possible. If we fail we'll more aggressively
         * retry.
         */
-       if ((!h2s_rxbuf_tail(h2s) || (full || !h2s_may_append_to_rxbuf(h2s))) && !h2s_get_rxbuf(h2s)) {
+       if ((!h2s_rxbuf_tail(h2s) || !h2s_may_append_to_rxbuf(h2s)) && !h2s_get_rxbuf(h2s)) {
                h2c->flags |= H2_CF_DEM_RXBUF;
                TRACE_STATE("waiting for an h2s rxbuf slot", H2_EV_RX_FRAME|H2_EV_RX_DATA|H2_EV_H2S_BLK, h2c->conn, h2s);
                goto fail;
@@ -6010,7 +6009,6 @@ static int h2_frt_transfer_data(struct h2s *h2s)
        htx = htx_from_buf(scbuf);
 
 try_again:
-       full = 0;
        flen = h2c->dfl - h2c->dpl;
        if (!flen)
                goto end_transfer;
@@ -6023,7 +6021,6 @@ try_again:
 
        block = htx_free_data_space(htx);
        if (!block) {
-               full = 1;
                if (h2s_get_rxbuf(h2s))
                        goto next_buffer;
 
@@ -6053,8 +6050,6 @@ try_again:
        }
 
        if (sent < flen) {
-               if (!sent)
-                       full = 1;
                if (h2s_get_rxbuf(h2s))
                        goto next_buffer;