mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-25 15:03:03 +00:00
MINOR: channel: simplify the channel's buffer allocation
The channel's buffer allocator, channel_alloc_buffer(), was still relying on the principle of a margin for the request and not for the response. But this margin stopped working around 1.7 with the introduction of the content filters such as SPOE, and was completely anihilated with the local pools that came with threads. Let's simplify this and just use b_alloc().
This commit is contained in:
parent
f499f50c8f
commit
0f495b3d87
@ -832,23 +832,15 @@ static inline int ci_space_for_replace(const struct channel *chn)
|
|||||||
return end - ci_tail(chn);
|
return end - ci_tail(chn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocates a buffer for channel <chn>, but only if it's guaranteed that it's
|
/* Allocates a buffer for channel <chn>. Returns 0 in case of failure, non-zero
|
||||||
* not the last available buffer or it's the response buffer. Unless the buffer
|
* otherwise.
|
||||||
* is the response buffer, an extra control is made so that we always keep
|
|
||||||
* <tune.buffers.reserved> buffers available after this allocation. Returns 0 in
|
|
||||||
* case of failure, non-zero otherwise.
|
|
||||||
*
|
*
|
||||||
* If no buffer are available, the requester, represented by <wait> pointer,
|
* If no buffer are available, the requester, represented by <wait> pointer,
|
||||||
* will be added in the list of objects waiting for an available buffer.
|
* will be added in the list of objects waiting for an available buffer.
|
||||||
*/
|
*/
|
||||||
static inline int channel_alloc_buffer(struct channel *chn, struct buffer_wait *wait)
|
static inline int channel_alloc_buffer(struct channel *chn, struct buffer_wait *wait)
|
||||||
{
|
{
|
||||||
int margin = 0;
|
if (b_alloc(&chn->buf) != NULL)
|
||||||
|
|
||||||
if (!(chn->flags & CF_ISRESP))
|
|
||||||
margin = global.tune.reserved_bufs;
|
|
||||||
|
|
||||||
if (b_alloc_margin(&chn->buf, margin) != NULL)
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!LIST_ADDED(&wait->list))
|
if (!LIST_ADDED(&wait->list))
|
||||||
|
Loading…
Reference in New Issue
Block a user