mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-02-10 03:41:24 +01:00
MINOR: h2: add h2_set_frame_size() to update the size in a binary frame
This function is called after preparing a frame, in order to update the frame's size in the frame header. It takes the frame payload length in argument. It simply writes a 24-bit frame size into a buffer, making use of the net_helper functions which try to optimize per platform (this is a frequently used operation).
This commit is contained in:
parent
2e43f08c60
commit
e482074c96
10
src/mux_h2.c
10
src/mux_h2.c
@ -14,6 +14,7 @@
|
||||
#include <common/config.h>
|
||||
#include <common/h2.h>
|
||||
#include <common/hpack-tbl.h>
|
||||
#include <common/net_helper.h>
|
||||
#include <proto/applet.h>
|
||||
#include <proto/connection.h>
|
||||
#include <proto/stream.h>
|
||||
@ -391,6 +392,15 @@ static inline void h2s_error(struct h2s *h2s, enum h2_err err)
|
||||
}
|
||||
}
|
||||
|
||||
/* writes the 24-bit frame size <len> at address <frame> */
|
||||
static inline void h2_set_frame_size(void *frame, uint32_t len)
|
||||
{
|
||||
uint8_t *out = frame;
|
||||
|
||||
*out = len >> 16;
|
||||
write_n16(out + 1, len);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
/* functions below are I/O callbacks from the connection */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user