MINPR: htx: Get large chunk if necessary to perform a defrag

Function performing defragmentation of an HTX message was updated to get a
chunk accordingly to the HTX message size.
This commit is contained in:
Christopher Faulet 2026-02-11 17:46:00 +01:00
parent 4c6ca0b471
commit 9ecd0011c1

View file

@ -39,8 +39,8 @@ static inline __attribute__((always_inline)) void htx_memcpy(void *dst, void *sr
*/
struct htx_blk *htx_defrag(struct htx *htx, struct htx_blk *blk, uint32_t blkinfo)
{
struct buffer *chunk;
struct htx *tmp;
struct buffer *chunk = get_trash_chunk_sz(htx->size+sizeof(struct htx));
struct htx *tmp = htxbuf(chunk);
struct htx_blk *newblk, *oldblk;
enum htx_blk_type type;
uint32_t new, old, blkpos;
@ -49,9 +49,6 @@ struct htx_blk *htx_defrag(struct htx *htx, struct htx_blk *blk, uint32_t blkinf
if (htx->head == -1)
return NULL;
chunk = alloc_trash_chunk();
tmp = htxbuf(chunk);
blkpos = -1;
new = 0;
@ -103,7 +100,6 @@ struct htx_blk *htx_defrag(struct htx *htx, struct htx_blk *blk, uint32_t blkinf
htx->flags &= ~(HTX_FL_FRAGMENTED|HTX_FL_UNORDERED);
htx_memcpy((void *)htx->blocks, (void *)tmp->blocks, htx->size);
free_trash_chunk(chunk);
return ((blkpos == -1) ? NULL : htx_get_blk(htx, blkpos));
}