From: Christopher Faulet Date: Thu, 23 May 2019 09:11:52 +0000 (+0200) Subject: MINOR: htx: Optimize htx_drain() when all data are drained X-Git-Tag: v2.0-dev5~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f6d6a9ab6d988395ab294bfff98168d716761b0;p=thirdparty%2Fhaproxy.git MINOR: htx: Optimize htx_drain() when all data are drained Instead of looping on the HTX message to drain all data, the message is now reset.. --- diff --git a/src/htx.c b/src/htx.c index dbf8dea379..60bfc049b2 100644 --- a/src/htx.c +++ b/src/htx.c @@ -309,6 +309,12 @@ struct htx_ret htx_drain(struct htx *htx, uint32_t count) struct htx_blk *blk; struct htx_ret htxret = { .blk = NULL, .ret = 0 }; + if (count == htx->data) { + htx_reset(htx); + htxret.ret = count; + return htxret; + } + blk = htx_get_head_blk(htx); while (count && blk) { uint32_t sz = htx_get_blksz(blk);