diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2021-09-16 00:15:36 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-16 16:50:23 +0200 |
commit | 0ccef94a496300becc4dd6e5a2bde3c7fe12dc68 (patch) | |
tree | 3f113c616b540474188bb60e4eb26ff30807fdfb /Kernel/Net/IPv4Socket.h | |
parent | f4d3c54c12f64edec0eeb1395c6531787dbd738e (diff) | |
download | serenity-0ccef94a496300becc4dd6e5a2bde3c7fe12dc68.zip |
Kernel: Drop the receive buffer when socket enters the TimeWait state
The TimeWait state is intended to prevent another socket from taking the
address tuple in case any packets are still in transit after the final
close. Since this state never delivers packets to userspace, it doesn't
make sense to keep the receive buffer around.
Diffstat (limited to 'Kernel/Net/IPv4Socket.h')
-rw-r--r-- | Kernel/Net/IPv4Socket.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h index 786d813c99..97b8e65e23 100644 --- a/Kernel/Net/IPv4Socket.h +++ b/Kernel/Net/IPv4Socket.h @@ -91,6 +91,7 @@ protected: void set_peer_address(IPv4Address address) { m_peer_address = address; } static KResultOr<NonnullOwnPtr<DoubleBuffer>> try_create_receive_buffer(); + void drop_receive_buffer(); private: virtual bool is_ipv4() const override { return true; } @@ -115,7 +116,7 @@ private: SinglyLinkedListWithCount<ReceivedPacket> m_receive_queue; - NonnullOwnPtr<DoubleBuffer> m_receive_buffer; + OwnPtr<DoubleBuffer> m_receive_buffer; u16 m_local_port { 0 }; u16 m_peer_port { 0 }; |