diff options
author | Subv <subv2112@gmail.com> | 2016-12-08 17:06:19 +0100 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2016-12-08 17:06:19 +0100 |
commit | f9bcf895103e5a6d99f5fe755bcac92b7781fd38 (patch) | |
tree | aebba4794da82175756a09e7d4d1de8d835bf412 /src/core/hle/kernel | |
parent | Return an error code when connecting to a saturated port. (diff) | |
download | yuzu-f9bcf895103e5a6d99f5fe755bcac92b7781fd38.tar yuzu-f9bcf895103e5a6d99f5fe755bcac92b7781fd38.tar.gz yuzu-f9bcf895103e5a6d99f5fe755bcac92b7781fd38.tar.bz2 yuzu-f9bcf895103e5a6d99f5fe755bcac92b7781fd38.tar.lz yuzu-f9bcf895103e5a6d99f5fe755bcac92b7781fd38.tar.xz yuzu-f9bcf895103e5a6d99f5fe755bcac92b7781fd38.tar.zst yuzu-f9bcf895103e5a6d99f5fe755bcac92b7781fd38.zip |
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/client_port.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/kernel/client_session.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/server_port.cpp | 2 | ||||
-rw-r--r-- | src/core/hle/kernel/server_session.cpp | 7 | ||||
-rw-r--r-- | src/core/hle/kernel/server_session.h | 4 |
5 files changed, 13 insertions, 7 deletions
diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp index 120ce554d..20179e546 100644 --- a/src/core/hle/kernel/client_port.cpp +++ b/src/core/hle/kernel/client_port.cpp @@ -15,6 +15,9 @@ ClientPort::ClientPort() {} ClientPort::~ClientPort() {} ResultVal<SharedPtr<ClientSession>> ClientPort::Connect() { + // Note: Threads do not wait for the server endpoint to call + // AcceptSession before returning from this call. + if (active_sessions >= max_sessions) { return ResultCode(ErrorDescription::MaxConnectionsReached, ErrorModule::OS, ErrorSummary::WouldBlock, @@ -27,7 +30,7 @@ ResultVal<SharedPtr<ClientSession>> ClientPort::Connect() { auto client_session = std::get<SharedPtr<ClientSession>>(sessions); auto server_session = std::get<SharedPtr<ServerSession>>(sessions); - server_port->pending_sessions.push_back(server_session); + server_port->pending_sessions.push_back(std::move(server_session)); // Wake the threads waiting on the ServerPort server_port->WakeupAllWaitingThreads(); diff --git a/src/core/hle/kernel/client_session.cpp b/src/core/hle/kernel/client_session.cpp index 6c577610d..30ef10764 100644 --- a/src/core/hle/kernel/client_session.cpp +++ b/src/core/hle/kernel/client_session.cpp @@ -16,7 +16,7 @@ ResultVal<SharedPtr<ClientSession>> ClientSession::Create(SharedPtr<ServerSessio SharedPtr<ClientSession> client_session(new ClientSession); client_session->name = std::move(name); - client_session->server_session = server_session; + client_session->server_session = std::move(server_session); return MakeResult<SharedPtr<ClientSession>>(std::move(client_session)); } diff --git a/src/core/hle/kernel/server_port.cpp b/src/core/hle/kernel/server_port.cpp index f90fe76d5..f7699f023 100644 --- a/src/core/hle/kernel/server_port.cpp +++ b/src/core/hle/kernel/server_port.cpp @@ -30,7 +30,7 @@ std::tuple<SharedPtr<ServerPort>, SharedPtr<ClientPort>> ServerPort::CreatePortP SharedPtr<ClientPort> client_port(new ClientPort); server_port->name = name + "_Server"; - server_port->hle_handler = hle_handler; + server_port->hle_handler = std::move(hle_handler); client_port->name = name + "_Client"; client_port->server_port = server_port; client_port->max_sessions = max_sessions; diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 3782cb493..f8bccadfd 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp @@ -18,7 +18,7 @@ ResultVal<SharedPtr<ServerSession>> ServerSession::Create(std::string name, std: server_session->name = std::move(name); server_session->signaled = false; - server_session->hle_handler = hle_handler; + server_session->hle_handler = std::move(hle_handler); return MakeResult<SharedPtr<ServerSession>>(std::move(server_session)); } @@ -46,8 +46,9 @@ ResultCode ServerSession::HandleSyncRequest() { return RESULT_SUCCESS; } -std::tuple<SharedPtr<ServerSession>, SharedPtr<ClientSession>> ServerSession::CreateSessionPair(const std::string& name, std::shared_ptr<Service::SessionRequestHandler> hle_handler) { - auto server_session = ServerSession::Create(name + "_Server", hle_handler).MoveFrom(); +ServerSession::SessionPair ServerSession::CreateSessionPair(const std::string& name, + std::shared_ptr<Service::SessionRequestHandler> hle_handler) { + auto server_session = ServerSession::Create(name + "_Server", std::move(hle_handler)).MoveFrom(); auto client_session = ClientSession::Create(server_session, name + "_Client").MoveFrom(); return std::make_tuple(std::move(server_session), std::move(client_session)); diff --git a/src/core/hle/kernel/server_session.h b/src/core/hle/kernel/server_session.h index c73ccee73..7f00db07b 100644 --- a/src/core/hle/kernel/server_session.h +++ b/src/core/hle/kernel/server_session.h @@ -40,12 +40,14 @@ public: return HANDLE_TYPE; } + using SessionPair = std::tuple<SharedPtr<ServerSession>, SharedPtr<ClientSession>>; + /** * Creates a pair of ServerSession and an associated ClientSession. * @param name Optional name of the ports * @return The created session tuple */ - static std::tuple<SharedPtr<ServerSession>, SharedPtr<ClientSession>> CreateSessionPair(const std::string& name = "Unknown", std::shared_ptr<Service::SessionRequestHandler> hle_handler = nullptr); + static SessionPair CreateSessionPair(const std::string& name = "Unknown", std::shared_ptr<Service::SessionRequestHandler> hle_handler = nullptr); /** * Handle a sync request from the emulated application. |