summaryrefslogtreecommitdiff
path: root/Kernel/Net/IPv4Socket.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-12-14 12:16:14 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-12-14 12:17:37 +0100
commit8b2280c3748cc3192b0eb99309cf740dee4932bf (patch)
tree66283952c4ae4b49b8f6c5100c7fa808d0081a58 /Kernel/Net/IPv4Socket.cpp
parentd723d9844ffe5596f81c1856b0604f31bddf1a65 (diff)
downloadserenity-8b2280c3748cc3192b0eb99309cf740dee4932bf.zip
Kernel: Allow buffering up to 128 KB in an IPv4Socket before refusing
Diffstat (limited to 'Kernel/Net/IPv4Socket.cpp')
-rw-r--r--Kernel/Net/IPv4Socket.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index 155fd9a659..ae4ceb136c 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -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);