mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
RequestServer: Replace Result<T, E> use with ErrorOr<T>
This commit is contained in:
parent
fbbb87d517
commit
01a6a4f7c4
2 changed files with 3 additions and 4 deletions
|
@ -35,13 +35,13 @@ Protocol::~Protocol()
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<Protocol::Pipe, String> Protocol::get_pipe_for_request()
|
ErrorOr<Protocol::Pipe> Protocol::get_pipe_for_request()
|
||||||
{
|
{
|
||||||
int fd_pair[2] { 0 };
|
int fd_pair[2] { 0 };
|
||||||
if (pipe(fd_pair) != 0) {
|
if (pipe(fd_pair) != 0) {
|
||||||
auto saved_errno = errno;
|
auto saved_errno = errno;
|
||||||
dbgln("Protocol: pipe() failed: {}", strerror(saved_errno));
|
dbgln("Protocol: pipe() failed: {}", strerror(saved_errno));
|
||||||
return String { strerror(saved_errno) };
|
return Error::from_errno(saved_errno);
|
||||||
}
|
}
|
||||||
fcntl(fd_pair[1], F_SETFL, fcntl(fd_pair[1], F_GETFL) | O_NONBLOCK);
|
fcntl(fd_pair[1], F_SETFL, fcntl(fd_pair[1], F_GETFL) | O_NONBLOCK);
|
||||||
return Pipe { fd_pair[0], fd_pair[1] };
|
return Pipe { fd_pair[0], fd_pair[1] };
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/RefPtr.h>
|
#include <AK/RefPtr.h>
|
||||||
#include <AK/Result.h>
|
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
#include <RequestServer/Forward.h>
|
#include <RequestServer/Forward.h>
|
||||||
|
|
||||||
|
@ -28,7 +27,7 @@ protected:
|
||||||
int read_fd { -1 };
|
int read_fd { -1 };
|
||||||
int write_fd { -1 };
|
int write_fd { -1 };
|
||||||
};
|
};
|
||||||
static Result<Pipe, String> get_pipe_for_request();
|
static ErrorOr<Pipe> get_pipe_for_request();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String m_name;
|
String m_name;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue