[ntcore] Provide mechanism to reset internals of NT instance (#4653)

This commit is contained in:
Dustin Spicuzza
2022-11-18 13:21:05 -05:00
committed by GitHub
parent 13aceea8dc
commit 388e7a4265
9 changed files with 62 additions and 0 deletions

View File

@@ -174,3 +174,15 @@ std::shared_ptr<INetworkClient> InstanceImpl::GetClient() {
std::scoped_lock lock{m_mutex};
return m_networkClient;
}
void InstanceImpl::Reset() {
std::scoped_lock lock{m_mutex};
m_networkServer.reset();
m_networkClient.reset();
m_servers.clear();
networkMode = NT_NET_MODE_NONE;
listenerStorage.Reset();
// connectionList should have been cleared by destroying networkClient/server
localStorage.Reset();
}