forked from suyu/suyu
service: Return proper result code for IPC::CommandType::Close.
This commit is contained in:
parent
34571f4d2e
commit
3597650f22
4 changed files with 12 additions and 9 deletions
|
@ -40,7 +40,7 @@ public:
|
||||||
* this request (ServerSession, Originator thread, Translated command buffer, etc).
|
* this request (ServerSession, Originator thread, Translated command buffer, etc).
|
||||||
* @returns ResultCode the result code of the translate operation.
|
* @returns ResultCode the result code of the translate operation.
|
||||||
*/
|
*/
|
||||||
virtual void HandleSyncRequest(SharedPtr<ServerSession> server_session) = 0;
|
virtual ResultCode HandleSyncRequest(SharedPtr<ServerSession> server_session) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signals that a client has just connected to this HLE handler and keeps the
|
* Signals that a client has just connected to this HLE handler and keeps the
|
||||||
|
|
|
@ -60,12 +60,13 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) {
|
||||||
// similar.
|
// similar.
|
||||||
|
|
||||||
// If this ServerSession has an associated HLE handler, forward the request to it.
|
// If this ServerSession has an associated HLE handler, forward the request to it.
|
||||||
|
ResultCode result{RESULT_SUCCESS};
|
||||||
if (hle_handler != nullptr) {
|
if (hle_handler != nullptr) {
|
||||||
// Attempt to translate the incoming request's command buffer.
|
// Attempt to translate the incoming request's command buffer.
|
||||||
ResultCode result = TranslateHLERequest(this);
|
ResultCode translate_result = TranslateHLERequest(this);
|
||||||
if (result.IsError())
|
if (translate_result.IsError())
|
||||||
return result;
|
return translate_result;
|
||||||
hle_handler->HandleSyncRequest(SharedPtr<ServerSession>(this));
|
result = hle_handler->HandleSyncRequest(SharedPtr<ServerSession>(this));
|
||||||
// TODO(Subv): Translate the response command buffer.
|
// TODO(Subv): Translate the response command buffer.
|
||||||
} else {
|
} else {
|
||||||
// Add the thread to the list of threads that have issued a sync request with this
|
// Add the thread to the list of threads that have issued a sync request with this
|
||||||
|
@ -76,7 +77,7 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) {
|
||||||
// If this ServerSession does not have an HLE implementation, just wake up the threads waiting
|
// If this ServerSession does not have an HLE implementation, just wake up the threads waiting
|
||||||
// on it.
|
// on it.
|
||||||
WakeupAllWaitingThreads();
|
WakeupAllWaitingThreads();
|
||||||
return RESULT_SUCCESS;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerSession::SessionPair ServerSession::CreateSessionPair(const std::string& name,
|
ServerSession::SessionPair ServerSession::CreateSessionPair(const std::string& name,
|
||||||
|
|
|
@ -124,7 +124,7 @@ void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) {
|
||||||
handler_invoker(this, info->handler_callback, ctx);
|
handler_invoker(this, info->handler_callback, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_session) {
|
ResultCode ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_session) {
|
||||||
u32* cmd_buf = (u32*)Memory::GetPointer(Kernel::GetCurrentThread()->GetTLSAddress());
|
u32* cmd_buf = (u32*)Memory::GetPointer(Kernel::GetCurrentThread()->GetTLSAddress());
|
||||||
|
|
||||||
// TODO(yuriks): The kernel should be the one handling this as part of translation after
|
// TODO(yuriks): The kernel should be the one handling this as part of translation after
|
||||||
|
@ -137,7 +137,7 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses
|
||||||
case IPC::CommandType::Close: {
|
case IPC::CommandType::Close: {
|
||||||
IPC::RequestBuilder rb{context, 1};
|
IPC::RequestBuilder rb{context, 1};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
break;
|
return ResultCode(ErrorModule::HIPC, ErrorDescription::RemoteProcessDead);
|
||||||
}
|
}
|
||||||
case IPC::CommandType::Control: {
|
case IPC::CommandType::Control: {
|
||||||
SM::g_service_manager->InvokeControlRequest(context);
|
SM::g_service_manager->InvokeControlRequest(context);
|
||||||
|
@ -153,6 +153,8 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses
|
||||||
|
|
||||||
context.WriteToOutgoingCommandBuffer(cmd_buf, *Kernel::g_current_process,
|
context.WriteToOutgoingCommandBuffer(cmd_buf, *Kernel::g_current_process,
|
||||||
Kernel::g_handle_table);
|
Kernel::g_handle_table);
|
||||||
|
|
||||||
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
|
|
||||||
void InvokeRequest(Kernel::HLERequestContext& ctx);
|
void InvokeRequest(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
void HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> server_session) override;
|
ResultCode HandleSyncRequest(Kernel::SharedPtr<Kernel::ServerSession> server_session) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Member-function pointer type of SyncRequest handlers.
|
/// Member-function pointer type of SyncRequest handlers.
|
||||||
|
|
Loading…
Reference in a new issue