mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-25 22:22:11 +00:00
MEDIUM: h1: Realign the ibuf before calling rcv_buf if needed.
If the ibuf only contains a small amount of data, realign it before calling rcv_buf(), as it's probably going to be cheaper to do so than to do 2 calls to recv().
This commit is contained in:
parent
cf42d5afa0
commit
29a22bc0a7
@ -1484,6 +1484,13 @@ static int h1_recv(struct h1c *h1c)
|
||||
goto end;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we only have a small amount of data, realign it,
|
||||
* it's probably cheaper than doing 2 recv() calls.
|
||||
*/
|
||||
if (b_data(&h1c->ibuf) > 0 && b_data(&h1c->ibuf) < 128)
|
||||
b_slow_realign(&h1c->ibuf, trash.area, 0);
|
||||
|
||||
max = b_room(&h1c->ibuf);
|
||||
if (max) {
|
||||
h1c->flags &= ~H1C_F_IN_FULL;
|
||||
|
Loading…
Reference in New Issue
Block a user