mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:07:34 +00:00
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. :(
This commit is contained in:
parent
9ae9d82a03
commit
767529ebf5
6 changed files with 19 additions and 17 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue