From: Willy Tarreau Date: Wed, 5 Dec 2018 08:47:34 +0000 (+0100) Subject: MINOR: htx: make htx_from_buf() adjust the size only on new buffers X-Git-Tag: v1.9-dev10~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ae4235f9454564dbb9f31cc827fccda5049e865;p=thirdparty%2Fhaproxy.git MINOR: htx: make htx_from_buf() adjust the size only on new buffers This one is used a lot during transfers, let's avoid resetting its size when there are already data in the buffer since it implies the size is correct. --- diff --git a/include/proto/htx.h b/include/proto/htx.h index e59bb4f48e..b6f1042f45 100644 --- a/include/proto/htx.h +++ b/include/proto/htx.h @@ -532,9 +532,10 @@ static inline struct htx *htx_from_buf(struct buffer *buf) if (b_is_null(buf)) return &htx_empty; htx = (struct htx *)(buf->area); - htx->size = buf->size - sizeof(*htx); - if (!b_data(buf)) + if (!b_data(buf)) { + htx->size = buf->size - sizeof(*htx); htx_reset(htx); + } return htx; }