summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/UDPServer.h
diff options
context:
space:
mode:
authorAlexander Narsudinov <a.narsudinov@gmail.com>2022-12-18 00:15:54 +0300
committerAndreas Kling <kling@serenityos.org>2022-12-20 10:45:20 +0100
commit767529ebf5b0108296428cdd2c45de50c3a29176 (patch)
tree676c6fe86c72f2218a1a2a56287355484fa7b195 /Userland/Libraries/LibCore/UDPServer.h
parent9ae9d82a033c4f893d2a58c178d6a6e73e8d2b63 (diff)
downloadserenity-767529ebf5b0108296428cdd2c45de50c3a29176.zip
LibCore: Make UDPServer::receive() return ErrorOr<ByteBuffer>
This is a first step towards handling OOM errors instead of just crashing the program. Now UDPServer's method `receive()` return memory allocation errors explicitly with help of ErrorOr. This removes one FIXME and make a bunch of new ones. :(
Diffstat (limited to 'Userland/Libraries/LibCore/UDPServer.h')
-rw-r--r--Userland/Libraries/LibCore/UDPServer.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibCore/UDPServer.h b/Userland/Libraries/LibCore/UDPServer.h
index 50ac61ee31..53e1407c57 100644
--- a/Userland/Libraries/LibCore/UDPServer.h
+++ b/Userland/Libraries/LibCore/UDPServer.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2022, Alexander Narsudinov <a.narsudinov@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -23,8 +24,8 @@ public:
bool is_bound() const { return m_bound; }
bool bind(IPv4Address const& address, u16 port);
- ByteBuffer receive(size_t size, sockaddr_in& from);
- ByteBuffer receive(size_t size)
+ ErrorOr<ByteBuffer> receive(size_t size, sockaddr_in& from);
+ ErrorOr<ByteBuffer> receive(size_t size)
{
struct sockaddr_in saddr;
return receive(size, saddr);