mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:17:35 +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
|
@ -28,7 +28,7 @@ DNSServer::DNSServer(Object* parent)
|
|||
ErrorOr<void> DNSServer::handle_client()
|
||||
{
|
||||
sockaddr_in client_address;
|
||||
auto buffer = receive(1024, client_address);
|
||||
auto buffer = TRY(receive(1024, client_address));
|
||||
auto optional_request = Packet::from_raw_packet(buffer.data(), buffer.size());
|
||||
if (!optional_request.has_value()) {
|
||||
dbgln("Got an invalid DNS packet");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue