mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-26 19:32:40 -06:00
sm:: fix lingering session initialization issues
This commit is contained in:
parent
87749d217e
commit
72e5552409
2 changed files with 19 additions and 2 deletions
|
@ -147,9 +147,21 @@ public:
|
|||
return server_manager;
|
||||
}
|
||||
|
||||
// TODO: remove this when sm: is implemented with the proper IUserInterface
|
||||
// abstraction, creating a new C++ handler object for each session:
|
||||
|
||||
bool GetIsInitializedForSm() const {
|
||||
return is_initialized_for_sm;
|
||||
}
|
||||
|
||||
void SetIsInitializedForSm() {
|
||||
is_initialized_for_sm = true;
|
||||
}
|
||||
|
||||
private:
|
||||
bool convert_to_domain{};
|
||||
bool is_domain{};
|
||||
bool is_initialized_for_sm{};
|
||||
SessionRequestHandlerPtr session_handler;
|
||||
std::vector<SessionRequestHandlerPtr> domain_handlers;
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ ResultVal<Kernel::KPort*> ServiceManager::GetServicePort(const std::string& name
|
|||
void SM::Initialize(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_SM, "called");
|
||||
|
||||
is_initialized = true;
|
||||
ctx.GetManager()->SetIsInitializedForSm();
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ResultSuccess);
|
||||
|
@ -159,7 +159,7 @@ static std::string PopServiceName(IPC::RequestParser& rp) {
|
|||
}
|
||||
|
||||
ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext& ctx) {
|
||||
if (!is_initialized) {
|
||||
if (!ctx.GetManager()->GetIsInitializedForSm()) {
|
||||
return ERR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
|
@ -168,6 +168,11 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext&
|
|||
|
||||
// Find the named port.
|
||||
auto port_result = service_manager.GetServicePort(name);
|
||||
if (port_result.Code() == ERR_INVALID_NAME) {
|
||||
LOG_ERROR(Service_SM, "Invalid service name '{}'", name);
|
||||
return ERR_INVALID_NAME;
|
||||
}
|
||||
|
||||
if (port_result.Failed()) {
|
||||
LOG_INFO(Service_SM, "Waiting for service {} to become available", name);
|
||||
ctx.SetIsDeferred();
|
||||
|
|
Loading…
Reference in a new issue