diff options
| author | bunnei <bunneidev@gmail.com> | 2018-01-22 21:37:15 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-22 21:37:15 -0500 |
| commit | d1b64cdc070c02b63398803136c04d4fe8bd0df0 (patch) | |
| tree | e41a908d37931f4a0de99f5fbe13cbb1f8a6f32c /src/core/hle/service/time/time.cpp | |
| parent | d8bd70d396597d652e8eb891175192ffaf728593 (diff) | |
| parent | b0489c9a64588d2140d9a98b69c5a0adc541a436 (diff) | |
Merge pull request #135 from Subv/no_ports
IPC: Don't create unnecessary ports when returning sub interfaces.
Diffstat (limited to 'src/core/hle/service/time/time.cpp')
| -rw-r--r-- | src/core/hle/service/time/time.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 9fed89246..8abb2ce7a 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp @@ -83,45 +83,45 @@ private: }; void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ctx) { - auto client_port = std::make_shared<ISystemClock>()->CreatePort(); - auto session = client_port->Connect(); - if (session.Succeeded()) { - LOG_DEBUG(Service, "called, initialized ISystemClock -> session=%u", - (*session)->GetObjectId()); - IPC::RequestBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); - rb.PushMoveObjects(std::move(session).Unwrap()); - } else { - UNIMPLEMENTED(); - } + // TODO(Subv): Verify if this should return the interface as a domain object when called from + // within a domain. + auto system_clock = std::make_shared<ISystemClock>(); + auto sessions = Kernel::ServerSession::CreateSessionPair(system_clock->GetServiceName()); + auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions); + auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions); + system_clock->ClientConnected(server); + LOG_DEBUG(Service, "called, initialized ISystemClock -> session=%u", client->GetObjectId()); + IPC::RequestBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushMoveObjects(std::move(client)); } void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) { - auto client_port = std::make_shared<ISystemClock>()->CreatePort(); - auto session = client_port->Connect(); - if (session.Succeeded()) { - LOG_DEBUG(Service, "called, initialized ISystemClock -> session=%u", - (*session)->GetObjectId()); - IPC::RequestBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); - rb.PushMoveObjects(std::move(session).Unwrap()); - } else { - UNIMPLEMENTED(); - } + // TODO(Subv): Verify if this should return the interface as a domain object when called from + // within a domain. + auto system_clock = std::make_shared<ISystemClock>(); + auto sessions = Kernel::ServerSession::CreateSessionPair(system_clock->GetServiceName()); + auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions); + auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions); + system_clock->ClientConnected(server); + LOG_DEBUG(Service, "called, initialized ISystemClock -> session=%u", client->GetObjectId()); + IPC::RequestBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushMoveObjects(std::move(client)); } void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) { - auto client_port = std::make_shared<ISteadyClock>()->CreatePort(); - auto session = client_port->Connect(); - if (session.Succeeded()) { - LOG_DEBUG(Service, "called, initialized ISteadyClock -> session=%u", - (*session)->GetObjectId()); - IPC::RequestBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); - rb.PushMoveObjects(std::move(session).Unwrap()); - } else { - UNIMPLEMENTED(); - } + // TODO(Subv): Verify if this should return the interface as a domain object when called from + // within a domain. + auto steady_clock = std::make_shared<ISteadyClock>(); + auto sessions = Kernel::ServerSession::CreateSessionPair(steady_clock->GetServiceName()); + auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions); + auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions); + steady_clock->ClientConnected(server); + LOG_DEBUG(Service, "called, initialized ISteadyClock -> session=%u", client->GetObjectId()); + IPC::RequestBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushMoveObjects(std::move(client)); } void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { |
