summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/k_server_port.cpp5
-rw-r--r--src/core/hle/kernel/kernel.cpp35
-rw-r--r--src/core/hle/kernel/kernel.h8
-rw-r--r--src/core/hle/kernel/svc.cpp1
-rw-r--r--src/core/hle/service/service.cpp4
5 files changed, 4 insertions, 49 deletions
diff --git a/src/core/hle/kernel/k_server_port.cpp b/src/core/hle/kernel/k_server_port.cpp
index 12e0c3ffb..16968ba97 100644
--- a/src/core/hle/kernel/k_server_port.cpp
+++ b/src/core/hle/kernel/k_server_port.cpp
@@ -19,8 +19,6 @@ void KServerPort::Initialize(KPort* parent_port_, std::string&& name_) {
// Set member variables.
parent = parent_port_;
name = std::move(name_);
-
- kernel.RegisterServerObject(this);
}
bool KServerPort::IsLight() const {
@@ -63,9 +61,6 @@ void KServerPort::Destroy() {
// Close our reference to our parent.
parent->Close();
-
- // Ensure that the global list tracking server objects does not hold on to a reference.
- kernel.UnregisterServerObject(this);
}
bool KServerPort::IsSignaled() const {
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 29e122dfd..054898638 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -185,17 +185,6 @@ struct KernelCore::Impl {
}
void CloseServices() {
- // Close all open server sessions and ports.
- std::unordered_set<KAutoObject*> server_objects_;
- {
- std::scoped_lock lk(server_objects_lock);
- server_objects_ = server_objects;
- server_objects.clear();
- }
- for (auto* server_object : server_objects_) {
- server_object->Close();
- }
-
// Ensures all service threads gracefully shutdown.
ClearServiceThreads();
}
@@ -699,9 +688,7 @@ struct KernelCore::Impl {
return {};
}
- KClientPort* port = &search->second(system.ServiceManager(), system);
- RegisterServerObject(&port->GetParent()->GetServerPort());
- return port;
+ return &search->second(system.ServiceManager(), system);
}
void RegisterNamedServiceHandler(std::string name, KServerPort* server_port) {
@@ -713,16 +700,6 @@ struct KernelCore::Impl {
search->second(system.ServiceManager(), server_port);
}
- void RegisterServerObject(KAutoObject* server_object) {
- std::scoped_lock lk(server_objects_lock);
- server_objects.insert(server_object);
- }
-
- void UnregisterServerObject(KAutoObject* server_object) {
- std::scoped_lock lk(server_objects_lock);
- server_objects.erase(server_object);
- }
-
std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(KernelCore& kernel,
const std::string& name) {
auto service_thread = std::make_shared<Kernel::ServiceThread>(kernel, name);
@@ -755,7 +732,6 @@ struct KernelCore::Impl {
service_thread_barrier.Sync();
}
- std::mutex server_objects_lock;
std::mutex registered_objects_lock;
std::mutex registered_in_use_objects_lock;
@@ -786,7 +762,6 @@ struct KernelCore::Impl {
std::unordered_map<std::string, ServiceInterfaceFactory> service_interface_factory;
std::unordered_map<std::string, ServiceInterfaceHandlerFn> service_interface_handlers;
NamedPortTable named_ports;
- std::unordered_set<KAutoObject*> server_objects;
std::unordered_set<KAutoObject*> registered_objects;
std::unordered_set<KAutoObject*> registered_in_use_objects;
@@ -1005,14 +980,6 @@ void KernelCore::RegisterNamedServiceHandler(std::string name, KServerPort* serv
impl->RegisterNamedServiceHandler(std::move(name), server_port);
}
-void KernelCore::RegisterServerObject(KAutoObject* server_object) {
- impl->RegisterServerObject(server_object);
-}
-
-void KernelCore::UnregisterServerObject(KAutoObject* server_object) {
- impl->UnregisterServerObject(server_object);
-}
-
void KernelCore::RegisterKernelObject(KAutoObject* object) {
std::scoped_lock lk{impl->registered_objects_lock};
impl->registered_objects.insert(object);
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 670f93ee3..4ae6b3923 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -204,14 +204,6 @@ public:
/// Accepts a session on a port created by CreateNamedServicePort.
void RegisterNamedServiceHandler(std::string name, KServerPort* server_port);
- /// Registers a server session or port with the gobal emulation state, to be freed on shutdown.
- /// This is necessary because we do not emulate processes for HLE sessions and ports.
- void RegisterServerObject(KAutoObject* server_object);
-
- /// Unregisters a server session or port previously registered with RegisterServerSession when
- /// it was destroyed during the current emulation session.
- void UnregisterServerObject(KAutoObject* server_object);
-
/// Registers all kernel objects with the global emulation state, this is purely for tracking
/// leaks after emulation has been shutdown.
void RegisterKernelObject(KAutoObject* object);
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 8d2c7d6b7..4c819f4b6 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -384,7 +384,6 @@ static Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr port_n
// Create a session.
KClientSession* session{};
R_TRY(port->CreateSession(std::addressof(session)));
- port->Close();
kernel.RegisterNamedServiceHandler(port_name, &port->GetParent()->GetServerPort());
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 0913a8065..6a64c6005 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -101,7 +101,9 @@ ServiceFrameworkBase::~ServiceFrameworkBase() {
const auto guard = LockService();
if (named_port != nullptr) {
- named_port->Close();
+ named_port->GetClientPort().Close();
+ named_port->GetServerPort().Close();
+ named_port = nullptr;
}
}