diff options
author | Subv <subv2112@gmail.com> | 2017-06-21 00:33:28 +0200 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2017-06-25 21:47:25 +0200 |
commit | 8feeb81af27ea8fed6888e26c1024be3b3231d48 (patch) | |
tree | 56944624b22abbcbd4e55233fd41f71e45abcef7 /src/core/hle/kernel/server_session.cpp | |
parent | Services/UDS: Set the proper bit in the ConnectionStatus structure when creating a network. (#2738) (diff) | |
download | yuzu-8feeb81af27ea8fed6888e26c1024be3b3231d48.tar yuzu-8feeb81af27ea8fed6888e26c1024be3b3231d48.tar.gz yuzu-8feeb81af27ea8fed6888e26c1024be3b3231d48.tar.bz2 yuzu-8feeb81af27ea8fed6888e26c1024be3b3231d48.tar.lz yuzu-8feeb81af27ea8fed6888e26c1024be3b3231d48.tar.xz yuzu-8feeb81af27ea8fed6888e26c1024be3b3231d48.tar.zst yuzu-8feeb81af27ea8fed6888e26c1024be3b3231d48.zip |
Diffstat (limited to 'src/core/hle/kernel/server_session.cpp')
-rw-r--r-- | src/core/hle/kernel/server_session.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 2dc709bc9..970eac5fe 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp @@ -32,22 +32,29 @@ ResultVal<SharedPtr<ServerSession>> ServerSession::Create(std::string name) { SharedPtr<ServerSession> server_session(new ServerSession); server_session->name = std::move(name); - server_session->signaled = false; server_session->parent = nullptr; return MakeResult(std::move(server_session)); } bool ServerSession::ShouldWait(Thread* thread) const { - return !signaled; + // Closed sessions should never wait, an error will be returned from svcReplyAndReceive. + if (parent->client == nullptr) + return false; + // Wait if we have no pending requests, or if we're currently handling a request. + return pending_requesting_threads.empty() || currently_handling != nullptr; } void ServerSession::Acquire(Thread* thread) { ASSERT_MSG(!ShouldWait(thread), "object unavailable!"); - signaled = false; + // We are now handling a request, pop it from the stack. + // TODO(Subv): What happens if the client endpoint is closed before any requests are made? + ASSERT(!pending_requesting_threads.empty()); + currently_handling = pending_requesting_threads.back(); + pending_requesting_threads.pop_back(); } -ResultCode ServerSession::HandleSyncRequest() { +ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) { // The ServerSession received a sync request, this means that there's new data available // from its ClientSession, so wake up any threads that may be waiting on a svcReplyAndReceive or // similar. @@ -60,11 +67,14 @@ ResultCode ServerSession::HandleSyncRequest() { return result; hle_handler->HandleSyncRequest(SharedPtr<ServerSession>(this)); // TODO(Subv): Translate the response command buffer. + } else { + // Add the thread to the list of threads that have issued a sync request with this + // server. + pending_requesting_threads.push_back(std::move(thread)); } // If this ServerSession does not have an HLE implementation, just wake up the threads waiting // on it. - signaled = true; WakeupAllWaitingThreads(); return RESULT_SUCCESS; } @@ -90,4 +100,4 @@ ResultCode TranslateHLERequest(ServerSession* server_session) { // TODO(Subv): Implement this function once multiple concurrent processes are supported. return RESULT_SUCCESS; } -} +} // namespace Kernel |