mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
Kernel: Avoid allocating KBuffers for TCP packets
This avoids allocating a KBuffer for each incoming TCP packet.
This commit is contained in:
parent
c0800ab898
commit
5feeb62843
Notes:
sideshowbarker
2024-07-18 18:18:11 +09:00
Author: https://github.com/gunnarbeutner
Commit: 5feeb62843
Pull-request: https://github.com/SerenityOS/serenity/pull/7049
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/bgianfo ✅
3 changed files with 7 additions and 7 deletions
|
@ -369,7 +369,7 @@ KResultOr<size_t> IPv4Socket::recvfrom(FileDescription& description, UserOrKerne
|
|||
return nreceived;
|
||||
}
|
||||
|
||||
bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port, KBuffer&& packet, const Time& packet_timestamp)
|
||||
bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port, ReadonlyBytes packet, const Time& packet_timestamp)
|
||||
{
|
||||
Locker locker(lock());
|
||||
|
||||
|
@ -398,7 +398,7 @@ bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port,
|
|||
dbgln("IPv4Socket({}): did_receive refusing packet since queue is full.", this);
|
||||
return false;
|
||||
}
|
||||
m_receive_queue.append({ source_address, source_port, packet_timestamp, move(packet) });
|
||||
m_receive_queue.append({ source_address, source_port, packet_timestamp, KBuffer::copy(packet.data(), packet.size()) });
|
||||
set_can_read(true);
|
||||
}
|
||||
m_bytes_received += packet_size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue