IPC/HLE: Associate the ClientSessions with their parent port's HLE interface if it exists.

Pass the triggering ServerSession to the HLE command handler to differentiate which session caused the request.
This commit is contained in:
Subv
2016-06-18 13:39:26 -05:00
parent c19afd2118
commit c5e7e0fa26
6 changed files with 21 additions and 26 deletions

View File

@ -8,6 +8,7 @@
#include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/service/service.h"
namespace Kernel {
@ -20,6 +21,7 @@ ResultVal<SharedPtr<ClientSession>> ClientSession::Create(SharedPtr<ServerSessio
client_session->name = std::move(name);
client_session->server_session = server_session;
client_session->client_port = client_port;
client_session->hle_helper = client_port->hle_interface;
return MakeResult<SharedPtr<ClientSession>>(std::move(client_session));
}
@ -31,10 +33,9 @@ ResultCode ClientSession::HandleSyncRequest() {
if (result.IsError())
return result;
// Tell the client port to handle the request in case it's an HLE service.
// The client port can be nullptr for port-less sessions (Like for example File and Directory sessions).
if (client_port != nullptr)
result = client_port->HandleSyncRequest();
// If this ClientSession has an associated HLE helper, forward the request to it.
if (hle_helper != nullptr)
result = hle_helper->HandleSyncRequest(server_session);
return result;
}