Kernel: Allow buffering up to 128 KB in an IPv4Socket before refusing
This commit is contained in:
parent
d723d9844f
commit
8b2280c374
Notes:
sideshowbarker
2024-07-19 10:51:55 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/8b2280c3748
1 changed files with 3 additions and 2 deletions
|
@ -335,8 +335,9 @@ bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port,
|
|||
auto packet_size = packet.size();
|
||||
|
||||
if (buffer_mode() == BufferMode::Bytes) {
|
||||
ASSERT(m_receive_buffer.bytes_in_write_buffer() < 65536);
|
||||
size_t space_in_receive_buffer = 65536 - (size_t)m_receive_buffer.bytes_in_write_buffer();
|
||||
constexpr size_t max_buffer_amount = 128 * KB;
|
||||
ASSERT((size_t)m_receive_buffer.bytes_in_write_buffer() < max_buffer_amount);
|
||||
size_t space_in_receive_buffer = max_buffer_amount - (size_t)m_receive_buffer.bytes_in_write_buffer();
|
||||
if (packet_size > space_in_receive_buffer) {
|
||||
kprintf("IPv4Socket(%p): did_receive refusing packet since buffer is full.\n", this);
|
||||
ASSERT(m_can_read);
|
||||
|
|
Loading…
Add table
Reference in a new issue