mirror of
https://github.com/PabloMK7/citra
synced 2024-11-15 05:08:23 +00:00
fixup! fixup! Service::SM: Wait till client is registered
This commit is contained in:
parent
aa98e55a88
commit
ae37b404c6
1 changed files with 10 additions and 11 deletions
|
@ -100,7 +100,7 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
// TODO(yuriks): Permission checks go here
|
// TODO(yuriks): Permission checks go here
|
||||||
|
|
||||||
auto get_handle = [name, this, wait_until_available](Kernel::SharedPtr<Kernel::Thread> thread,
|
auto get_handle = [name, this](Kernel::SharedPtr<Kernel::Thread> thread,
|
||||||
Kernel::HLERequestContext& ctx,
|
Kernel::HLERequestContext& ctx,
|
||||||
ThreadWakeupReason reason) {
|
ThreadWakeupReason reason) {
|
||||||
LOG_ERROR(Service_SRV, "called service={} wakeup", name);
|
LOG_ERROR(Service_SRV, "called service={} wakeup", name);
|
||||||
|
@ -113,11 +113,9 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestBuilder rb(ctx, 0x5, 1, 2);
|
IPC::RequestBuilder rb(ctx, 0x5, 1, 2);
|
||||||
rb.Push(session.Code());
|
rb.Push(session.Code());
|
||||||
rb.PushMoveObjects(std::move(session).Unwrap());
|
rb.PushMoveObjects(std::move(session).Unwrap());
|
||||||
} else if (session.Code() == Kernel::ERR_MAX_CONNECTIONS_REACHED && wait_until_available) {
|
} else if (session.Code() == Kernel::ERR_MAX_CONNECTIONS_REACHED) {
|
||||||
LOG_WARNING(Service_SRV, "called service={} -> ERR_MAX_CONNECTIONS_REACHED", name);
|
LOG_ERROR(Service_SRV, "called service={} -> ERR_MAX_CONNECTIONS_REACHED", name);
|
||||||
// TODO(Subv): Put the caller guest thread to sleep until this port becomes available
|
UNREACHABLE();
|
||||||
// again.
|
|
||||||
UNIMPLEMENTED_MSG("Unimplemented wait until port {} is available.", name);
|
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Service_SRV, "called service={} -> error 0x{:08X}", name, session.Code().raw);
|
LOG_ERROR(Service_SRV, "called service={} -> error 0x{:08X}", name, session.Code().raw);
|
||||||
IPC::RequestBuilder rb(ctx, 0x5, 1, 0);
|
IPC::RequestBuilder rb(ctx, 0x5, 1, 0);
|
||||||
|
@ -127,8 +125,8 @@ void SRV::GetServiceHandle(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
||||||
auto client_port = service_manager->GetServicePort(name);
|
auto client_port = service_manager->GetServicePort(name);
|
||||||
if (client_port.Failed()) {
|
if (client_port.Failed()) {
|
||||||
if (wait_until_available) {
|
if (wait_until_available && client_port.Code() == ERR_SERVICE_NOT_REGISTERED) {
|
||||||
LOG_ERROR(Service_SRV, "called service={} delayed", name);
|
LOG_INFO(Service_SRV, "called service={} delayed", name);
|
||||||
Kernel::SharedPtr<Kernel::Event> get_service_handle_event =
|
Kernel::SharedPtr<Kernel::Event> get_service_handle_event =
|
||||||
ctx.SleepClientThread(Kernel::GetCurrentThread(), "GetServiceHandle",
|
ctx.SleepClientThread(Kernel::GetCurrentThread(), "GetServiceHandle",
|
||||||
std::chrono::nanoseconds(-1), get_handle);
|
std::chrono::nanoseconds(-1), get_handle);
|
||||||
|
@ -235,9 +233,10 @@ void SRV::RegisterService(Kernel::HLERequestContext& ctx) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_service_handle_delayed_map.find(name) != get_service_handle_delayed_map.end()) {
|
auto it = get_service_handle_delayed_map.find(name);
|
||||||
get_service_handle_delayed_map.at(name)->Signal();
|
if (it != get_service_handle_delayed_map.end()) {
|
||||||
get_service_handle_delayed_map.erase(name);
|
it->second->Signal();
|
||||||
|
get_service_handle_delayed_map.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||||
|
|
Loading…
Reference in a new issue