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 dbf8dea..60bfc04 100644
--- a/src/htx.c
+++ b/src/htx.c
@@ -309,6 +309,12 @@
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);