diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-08-01 02:42:03 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-03 18:54:23 +0200 |
commit | ca94a833374b3fec720cc8ee911b9824c3021828 (patch) | |
tree | a3b14210db48faae752c23f329cf5f96875ae98e /Kernel/Net/TCPSocket.h | |
parent | 109c885585a980a68448348873f707b860e5a910 (diff) | |
download | serenity-ca94a833374b3fec720cc8ee911b9824c3021828.zip |
Kernel: Handle OOM from DoubleBuffer usage in IPv4Socket
The IPv4Socket requires a DoubleBuffer for storage of any data it
received on the socket. However it was previously using the default
constructor which can not observe allocation failure. Address this by
plumbing the receive buffer through the various derived classes.
Diffstat (limited to 'Kernel/Net/TCPSocket.h')
-rw-r--r-- | Kernel/Net/TCPSocket.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h index 83a74abdb6..73b076b924 100644 --- a/Kernel/Net/TCPSocket.h +++ b/Kernel/Net/TCPSocket.h @@ -18,7 +18,7 @@ namespace Kernel { class TCPSocket final : public IPv4Socket { public: static void for_each(Function<void(const TCPSocket&)>); - static KResultOr<NonnullRefPtr<TCPSocket>> create(int protocol); + static KResultOr<NonnullRefPtr<TCPSocket>> create(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer); virtual ~TCPSocket() override; enum class Direction { @@ -165,7 +165,7 @@ protected: void set_direction(Direction direction) { m_direction = direction; } private: - explicit TCPSocket(int protocol); + explicit TCPSocket(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer); virtual StringView class_name() const override { return "TCPSocket"; } virtual void shut_down_for_writing() override; |