BUG/MINOR: channel/htx: Call channel_htx_full() from channel_full()

When channel_full() is called for an HTX stream, we fall back on the HTX
version. This function is called, among other, from tcp_inspect_request(). With
this patch, the inspect delay is respected again.

This patch must be backported to 1.9.
This commit is contained in:
Christopher Faulet 2019-06-11 14:14:49 +02:00
parent 647fe1d9e1
commit 87ebe944d6

View File

@ -749,6 +749,19 @@ static inline int channel_htx_recv_limit(const struct channel *chn, const struct
return (htx_max_data_space(htx) - reserve);
}
/* HTX version of channel_full(). Instead of checking if INPUT data exceeds
* (size - reserve), this function checks if the free space for data in <htx>
* and the data scheduled for output are lower to the reserve. In such case, the
* channel is considered as full.
*/
static inline int channel_htx_full(const struct channel *c, const struct htx *htx,
unsigned int reserve)
{
if (!htx->size)
return 0;
return (htx_free_data_space(htx) + co_data(c) <= reserve);
}
/* Returns non-zero if the channel's INPUT buffer's is considered full, which
* means that it holds at least as much INPUT data as (size - reserve). This
* also means that data that are scheduled for output are considered as potential
@ -763,23 +776,12 @@ static inline int channel_full(const struct channel *c, unsigned int reserve)
if (b_is_null(&c->buf))
return 0;
if (IS_HTX_STRM(chn_strm(c)))
return channel_htx_full(c, htxbuf(&c->buf), reserve);
return (ci_data(c) + reserve >= c_size(c));
}
/* HTX version of channel_full(). Instead of checking if INPUT data exceeds
* (size - reserve), this function checks if the free space for data in <htx>
* and the data scheduled for output are lower to the reserve. In such case, the
* channel is considered as full.
*/
static inline int channel_htx_full(const struct channel *c, const struct htx *htx,
unsigned int reserve)
{
if (!htx->size)
return 0;
return (htx_free_data_space(htx) + co_data(c) <= reserve);
}
/* HTX version of channel_recv_max(). */
static inline int channel_htx_recv_max(const struct channel *chn, const struct htx *htx)
{