]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h2: use b_slow_realign() with the trash as a swap buffer
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Jul 2018 09:00:01 +0000 (11:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jul 2018 14:23:40 +0000 (16:23 +0200)
H2 doesn't use the trash so it can make use of it as a swap area when
calling b_slow_realign(). This way we don't need buffer_slow_realign()
anymore.

src/mux_h2.c

index 32103026131dca9a7191831584409d54efaf0c7f..9a1d71867f36853bdf87da5047f63400c2592fe6 100644 (file)
@@ -2688,7 +2688,7 @@ static int h2_frt_decode_headers(struct h2s *h2s, struct buffer *buf, int count)
                /* it doesn't fit and the buffer is fragmented,
                 * so let's defragment it and try again.
                 */
-               buffer_slow_realign(buf, 0);
+               b_slow_realign(buf, trash.str, 0);
        }
 
        /* first check if we have some room after p+i */
@@ -2995,7 +2995,7 @@ static int h2s_frt_make_resp_headers(struct h2s *h2s, struct buffer *buf)
                if (outbuf.size >= 9 || !buffer_space_wraps(h2c->mbuf))
                        break;
        realign_again:
-               buffer_slow_realign(h2c->mbuf, h2c->mbuf->o);
+               b_slow_realign(h2c->mbuf, trash.str, h2c->mbuf->o);
        }
 
        if (outbuf.size < 9) {
@@ -3153,7 +3153,7 @@ static int h2s_frt_make_resp_data(struct h2s *h2s, struct buffer *buf)
                if (outbuf.size >= 9 || !buffer_space_wraps(h2c->mbuf))
                        break;
        realign_again:
-               buffer_slow_realign(h2c->mbuf, h2c->mbuf->o);
+               b_slow_realign(h2c->mbuf, trash.str, h2c->mbuf->o);
        }
 
        if (outbuf.size < 9) {