From db76949cff312619a1aa76c10622362eb5b9997b Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 24 Oct 2024 14:11:06 +0200 Subject: [PATCH] CLEANUP: mux-h2: remove the unused "full" variable in h2_frt_transfer_data() 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 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mux_h2.c b/src/mux_h2.c index 349307475f..3d0509c5d8 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -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 @@ static int h2_frt_transfer_data(struct h2s *h2s) block = htx_free_data_space(htx); if (!block) { - full = 1; if (h2s_get_rxbuf(h2s)) goto next_buffer; @@ -6053,8 +6050,6 @@ static int h2_frt_transfer_data(struct h2s *h2s) } if (sent < flen) { - if (!sent) - full = 1; if (h2s_get_rxbuf(h2s)) goto next_buffer;