mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:57:36 +00:00
LibCore: Make LocalServer::take_over_from_system_server() return ErrorOr
This allows us to use TRY() or MUST() when calling it.
This commit is contained in:
parent
229a45ab14
commit
81047d8f9c
13 changed files with 41 additions and 53 deletions
|
@ -23,8 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
Core::EventLoop event_loop;
|
||||
auto mixer = TRY(AudioServer::Mixer::try_create(config));
|
||||
auto server = TRY(Core::LocalServer::try_create());
|
||||
bool ok = server->take_over_from_system_server();
|
||||
VERIFY(ok);
|
||||
TRY(server->take_over_from_system_server());
|
||||
|
||||
server->on_accept = [&](NonnullRefPtr<Core::LocalSocket> client_socket) {
|
||||
static int s_next_client_id = 0;
|
||||
|
|
|
@ -19,8 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto server = TRY(Core::LocalServer::try_create());
|
||||
bool ok = server->take_over_from_system_server();
|
||||
VERIFY(ok);
|
||||
TRY(server->take_over_from_system_server());
|
||||
|
||||
server->on_accept = [&](auto client_socket) {
|
||||
static int s_next_client_id = 0;
|
||||
|
|
|
@ -17,10 +17,9 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
Core::EventLoop event_loop;
|
||||
auto server = TRY(Core::LocalServer::try_create());
|
||||
|
||||
bool ok = server->take_over_from_system_server();
|
||||
VERIFY(ok);
|
||||
auto server = TRY(Core::LocalServer::try_create());
|
||||
TRY(server->take_over_from_system_server());
|
||||
server->on_accept = [&](auto client_socket) {
|
||||
static int s_next_client_id = 0;
|
||||
int client_id = ++s_next_client_id;
|
||||
|
|
|
@ -19,8 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio unix accept"));
|
||||
|
||||
bool ok = server->take_over_from_system_server("/tmp/portal/inspector");
|
||||
VERIFY(ok);
|
||||
TRY(server->take_over_from_system_server("/tmp/portal/inspector"));
|
||||
server->on_accept = [&](auto client_socket) {
|
||||
static int s_next_client_id = 0;
|
||||
int client_id = ++s_next_client_id;
|
||||
|
@ -28,8 +27,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
};
|
||||
|
||||
auto inspectables_server = TRY(Core::LocalServer::try_create());
|
||||
if (!inspectables_server->take_over_from_system_server("/tmp/portal/inspectables"))
|
||||
VERIFY_NOT_REACHED();
|
||||
TRY(inspectables_server->take_over_from_system_server("/tmp/portal/inspectables"));
|
||||
|
||||
inspectables_server->on_accept = [&](auto client_socket) {
|
||||
auto pid = client_socket->peer_pid();
|
||||
|
|
|
@ -23,8 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
|
||||
TRY(Core::System::pledge("stdio accept rpath proc exec"));
|
||||
|
||||
bool ok = server->take_over_from_system_server();
|
||||
VERIFY(ok);
|
||||
TRY(server->take_over_from_system_server());
|
||||
server->on_accept = [&](auto client_socket) {
|
||||
static int s_next_client_id = 0;
|
||||
int client_id = ++s_next_client_id;
|
||||
|
|
|
@ -78,8 +78,7 @@ LookupServer::LookupServer()
|
|||
int client_id = ++s_next_client_id;
|
||||
(void)IPC::new_client_connection<ClientConnection>(move(client_socket), client_id);
|
||||
};
|
||||
bool ok = m_local_server->take_over_from_system_server();
|
||||
VERIFY(ok);
|
||||
MUST(m_local_server->take_over_from_system_server());
|
||||
}
|
||||
|
||||
void LookupServer::load_etc_hosts()
|
||||
|
|
|
@ -18,8 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
auto server = TRY(Core::LocalServer::try_create());
|
||||
|
||||
bool ok = server->take_over_from_system_server();
|
||||
VERIFY(ok);
|
||||
TRY(server->take_over_from_system_server());
|
||||
server->on_accept = [&](auto client_socket) {
|
||||
static int s_next_client_id = 0;
|
||||
int client_id = ++s_next_client_id;
|
||||
|
|
|
@ -25,10 +25,9 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
Core::EventLoop event_loop;
|
||||
auto server = TRY(Core::LocalServer::try_create());
|
||||
bool ok = server->take_over_from_system_server();
|
||||
VERIFY(ok);
|
||||
|
||||
auto server = TRY(Core::LocalServer::try_create());
|
||||
TRY(server->take_over_from_system_server());
|
||||
server->on_accept = [&](auto client_socket) {
|
||||
static int s_next_client_id = 0;
|
||||
int client_id = ++s_next_client_id;
|
||||
|
|
|
@ -25,10 +25,8 @@ EventLoop::EventLoop()
|
|||
m_keyboard_fd = open("/dev/keyboard0", O_RDONLY | O_NONBLOCK | O_CLOEXEC);
|
||||
m_mouse_fd = open("/dev/mouse0", O_RDONLY | O_NONBLOCK | O_CLOEXEC);
|
||||
|
||||
bool ok = m_window_server->take_over_from_system_server("/tmp/portal/window");
|
||||
VERIFY(ok);
|
||||
ok = m_wm_server->take_over_from_system_server("/tmp/portal/wm");
|
||||
VERIFY(ok);
|
||||
MUST(m_window_server->take_over_from_system_server("/tmp/portal/window"));
|
||||
MUST(m_wm_server->take_over_from_system_server("/tmp/portal/wm"));
|
||||
|
||||
m_window_server->on_accept = [&](auto client_socket) {
|
||||
static int s_next_client_id = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue