1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:18:11 +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:
Alexander Narsudinov 2022-12-18 00:15:54 +03:00 committed by Andreas Kling
parent 9ae9d82a03
commit 767529ebf5
6 changed files with 19 additions and 17 deletions

View file

@ -291,7 +291,9 @@ TEST_CASE(udp_socket_read_write)
usleep(100000);
struct sockaddr_in client_address;
auto server_receive_buffer = udp_server->receive(64, client_address);
auto server_receive_buffer_or_error = udp_server->receive(64, client_address);
EXPECT(!server_receive_buffer_or_error.is_error());
auto server_receive_buffer = server_receive_buffer_or_error.release_value();
EXPECT(!server_receive_buffer.is_empty());
StringView server_received_data { server_receive_buffer.bytes() };