summaryrefslogtreecommitdiff
path: root/Kernel/Net/LocalSocket.h
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-08-01 02:34:10 -0700
committerAndreas Kling <kling@serenityos.org>2021-08-03 18:54:23 +0200
commit109c885585a980a68448348873f707b860e5a910 (patch)
treef31c990269c63bb0d1268eff7f5d1f5e21264dae /Kernel/Net/LocalSocket.h
parent8d3b819daf659ee9ce7628d3ddd1e7ca3876fcf5 (diff)
downloadserenity-109c885585a980a68448348873f707b860e5a910.zip
Kernel: Handle OOM from DoubleBuffer usage in Net/LocalSocket
LocalSockets keep a DoubleBuffer for both client and server usage. This change converts the usage from using the default constructor which is unable to observe OOM, to the new try_create factory and plumb the result through the constructor.
Diffstat (limited to 'Kernel/Net/LocalSocket.h')
-rw-r--r--Kernel/Net/LocalSocket.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Net/LocalSocket.h b/Kernel/Net/LocalSocket.h
index 1fc56c59a7..a019e9142b 100644
--- a/Kernel/Net/LocalSocket.h
+++ b/Kernel/Net/LocalSocket.h
@@ -51,7 +51,7 @@ public:
virtual KResult chmod(FileDescription&, mode_t) override;
private:
- explicit LocalSocket(int type);
+ explicit LocalSocket(int type, NonnullOwnPtr<DoubleBuffer> client_buffer, NonnullOwnPtr<DoubleBuffer> server_buffer);
virtual StringView class_name() const override { return "LocalSocket"; }
virtual bool is_local() const override { return true; }
bool has_attached_peer(const FileDescription&) const;
@@ -93,8 +93,8 @@ private:
bool m_accept_side_fd_open { false };
sockaddr_un m_address { 0, { 0 } };
- DoubleBuffer m_for_client;
- DoubleBuffer m_for_server;
+ NonnullOwnPtr<DoubleBuffer> m_for_client;
+ NonnullOwnPtr<DoubleBuffer> m_for_server;
NonnullRefPtrVector<FileDescription> m_fds_for_client;
NonnullRefPtrVector<FileDescription> m_fds_for_server;