For a long time we've been realigning empty buffers in the transport
layers, where the I/Os were performed based on callbacks. Doing so is
optimal for higher data throughput but makes it trickier to optimize
unaligned data, where mux_h1/h2 have to claim some data are present
in the buffer to force unaligned accesses to skip the frame's header
or the chunk header.
We don't need to do this anymore since the I/O calls are now always
performed from top to bottom, so it's only the mux's responsibility
to realign an empty buffer if it wants to.
In practice it doesn't change anything, it's just a convention, and
it will allow the code to be simplified in a next patch.
int aligned = 0;
h1c->flags &= ~H1C_F_IN_FULL;
+ b_realign_if_empty(&h1c->ibuf);
if (!b_data(&h1c->ibuf)) {
/* try to pre-align the buffer like the rxbufs will be
* to optimize memory copies.
do {
int aligned = 0;
+ b_realign_if_empty(buf);
if (!b_data(buf) && (h2c->proxy->options2 & PR_O2_USE_HTX)) {
/* HTX in use : try to pre-align the buffer like the
* rxbufs will be to optimize memory copies. We'll make
cs->flags |= CS_FL_RCV_MORE;
return 0;
}
+ b_realign_if_empty(buf);
ret = cs->conn->xprt->rcv_buf(cs->conn, buf, count, flags);
if (conn_xprt_read0_pending(cs->conn)) {
if (ret == 0)
}
}
- b_realign_if_empty(buf);
-
/* read the largest possible block. For this, we perform only one call
* to recv() unless the buffer wraps and we exactly fill the first hunk,
* in which case we accept to do it once again. A new attempt is made on
/* a handshake was requested */
return 0;
- b_realign_if_empty(buf);
-
/* read the largest possible block. For this, we perform only one call
* to recv() unless the buffer wraps and we exactly fill the first hunk,
* in which case we accept to do it once again. A new attempt is made on