Просмотр исходного кода

hle: kernel: KServerSession: Fix client disconnected.

- Prevents a cloned session's handler from being overwritten by another disconnected session.
- Fixes session handler nullptr asserts with Pokemon Sword & Shield.
bunnei 5 лет назад
Родитель
Сommit
b2971b48ed
3 измененных файлов с 8 добавлено и 9 удалено
  1. 2 2
      src/core/hle/kernel/hle_ipc.cpp
  2. 5 6
      src/core/hle/kernel/k_server_session.h
  3. 1 1
      src/core/hle/service/service.h

+ 2 - 2
src/core/hle/kernel/hle_ipc.cpp

@@ -57,11 +57,11 @@ bool SessionRequestManager::HasSessionRequestHandler(const HLERequestContext& co
 }
 }
 
 
 void SessionRequestHandler::ClientConnected(KServerSession* session) {
 void SessionRequestHandler::ClientConnected(KServerSession* session) {
-    session->SetSessionHandler(shared_from_this());
+    session->ClientConnected(shared_from_this());
 }
 }
 
 
 void SessionRequestHandler::ClientDisconnected(KServerSession* session) {
 void SessionRequestHandler::ClientDisconnected(KServerSession* session) {
-    session->SetSessionHandler(nullptr);
+    session->ClientDisconnected();
 }
 }
 
 
 HLERequestContext::HLERequestContext(KernelCore& kernel_, Core::Memory::Memory& memory_,
 HLERequestContext::HLERequestContext(KernelCore& kernel_, Core::Memory::Memory& memory_,

+ 5 - 6
src/core/hle/kernel/k_server_session.h

@@ -62,15 +62,14 @@ public:
 
 
     void OnClientClosed();
     void OnClientClosed();
 
 
-    /**
-     * Sets the HLE handler for the session. This handler will be called to service IPC requests
-     * instead of the regular IPC machinery. (The regular IPC machinery is currently not
-     * implemented.)
-     */
-    void SetSessionHandler(SessionRequestHandlerPtr handler) {
+    void ClientConnected(SessionRequestHandlerPtr handler) {
         manager->SetSessionHandler(std::move(handler));
         manager->SetSessionHandler(std::move(handler));
     }
     }
 
 
+    void ClientDisconnected() {
+        manager = nullptr;
+    }
+
     /**
     /**
      * Handle a sync request from the emulated application.
      * Handle a sync request from the emulated application.
      *
      *

+ 1 - 1
src/core/hle/service/service.h

@@ -42,7 +42,7 @@ class ServiceManager;
 
 
 static const int kMaxPortSize = 8; ///< Maximum size of a port name (8 characters)
 static const int kMaxPortSize = 8; ///< Maximum size of a port name (8 characters)
 /// Arbitrary default number of maximum connections to an HLE service.
 /// Arbitrary default number of maximum connections to an HLE service.
-static const u32 DefaultMaxSessions = 0x10000;
+static const u32 DefaultMaxSessions = 0x100;
 
 
 /**
 /**
  * This is an non-templated base of ServiceFramework to reduce code bloat and compilation times, it
  * This is an non-templated base of ServiceFramework to reduce code bloat and compilation times, it