mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-03 16:15:12 -04:00
[BUG] buffer_forward() would not correctly consider data already scheduled
The computations in buffer_forward() were only valid if buffer_forward()
was used on a buffer which had no more data scheduled for forwarding.
This is always the case right now so this bug is not yet triggered but
it will soon be. Now we correctly discount the bytes to be forwarded
from the data already present in the buffer.
(cherry picked from commit 91aa577b1f)
This commit is contained in:
parent
29b366dcdd
commit
db95cd94c0
1 changed files with 5 additions and 4 deletions
|
|
@ -99,12 +99,13 @@ static inline void buffer_forward(struct buffer *buf, unsigned int bytes)
|
|||
{
|
||||
unsigned int data_left;
|
||||
|
||||
buf->to_forward += bytes;
|
||||
data_left = buf->l - buf->send_max;
|
||||
if (data_left > buf->to_forward)
|
||||
data_left = buf->to_forward;
|
||||
if (data_left >= bytes) {
|
||||
buf->send_max += bytes;
|
||||
return;
|
||||
}
|
||||
|
||||
buf->to_forward -= data_left;
|
||||
buf->to_forward += bytes - data_left;
|
||||
buf->send_max += data_left;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue