mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-04 17:33:04 +00:00
Kernel: Avoid allocations when handling network packets
This commit is contained in:
parent
53d0150827
commit
006f11f23d
Notes:
sideshowbarker
2024-07-18 18:01:33 +09:00
Author: https://github.com/gunnarbeutner
Commit: 006f11f23d
Pull-request: https://github.com/SerenityOS/serenity/pull/7151
Reviewed-by: https://github.com/alimpfard
5 changed files with 8 additions and 6 deletions
|
@ -186,7 +186,7 @@ KResult TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* payload,
|
|||
const size_t options_size = has_mss_option ? sizeof(TCPOptionMSS) : 0;
|
||||
const size_t header_size = sizeof(TCPPacket) + options_size;
|
||||
const size_t buffer_size = header_size + payload_size;
|
||||
auto buffer = ByteBuffer::create_zeroed(buffer_size);
|
||||
auto buffer = NetworkByteBuffer::create_zeroed(buffer_size);
|
||||
auto& tcp_packet = *(TCPPacket*)(buffer.data());
|
||||
VERIFY(local_port());
|
||||
tcp_packet.set_source_port(local_port());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue