mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-19 04:00:46 +00:00
MINOR: flt_trace: Use htx_find_offset() to get the available payload length
The trace_get_htx_datalen() function now uses htx_find_offset() to get the payload length, ie. the length of consecutives DATA blocks.
This commit is contained in:
parent
bb76aa4d37
commit
24598a499f
@ -157,23 +157,22 @@ static unsigned int
|
|||||||
trace_get_htx_datalen(struct htx *htx, unsigned int offset, unsigned int len)
|
trace_get_htx_datalen(struct htx *htx, unsigned int offset, unsigned int len)
|
||||||
{
|
{
|
||||||
struct htx_blk *blk;
|
struct htx_blk *blk;
|
||||||
uint32_t sz, data = 0;
|
struct htx_ret htxret = htx_find_offset(htx, offset);
|
||||||
|
uint32_t data = 0;
|
||||||
|
|
||||||
for (blk = htx_get_first_blk(htx); blk; blk = htx_get_next_blk(htx, blk)) {
|
blk = htxret.blk;
|
||||||
if (htx_get_blk_type(blk) != HTX_BLK_DATA)
|
if (blk && htxret.ret && htx_get_blk_type(blk) == HTX_BLK_DATA) {
|
||||||
|
data += htxret.ret;
|
||||||
|
blk = htx_get_next_blk(htx, blk);
|
||||||
|
}
|
||||||
|
while (blk) {
|
||||||
|
if (htx_get_blk_type(blk) == HTX_BLK_UNUSED)
|
||||||
|
goto next;
|
||||||
|
else if (htx_get_blk_type(blk) != HTX_BLK_DATA)
|
||||||
break;
|
break;
|
||||||
|
data += htx_get_blksz(blk);
|
||||||
sz = htx_get_blksz(blk);
|
next:
|
||||||
if (offset >= sz) {
|
blk = htx_get_next_blk(htx, blk);
|
||||||
offset -= sz;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
data += sz - offset;
|
|
||||||
offset = 0;
|
|
||||||
if (data > len) {
|
|
||||||
data = len;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user