Fix order of ops issue in MP Session Termination

Signed-off-by: John <jonawals@amazon.com>
This commit is contained in:
puvvadar
2021-06-24 13:56:16 -07:00
committed by John
parent 0a2b51c32d
commit 0fb23a9708
@@ -219,7 +219,8 @@ namespace Multiplayer
// Cleanup connections, fire events and uninitialize state
auto visitor = [reason](IConnection& connection) { connection.Disconnect(reason, TerminationEndpoint::Local); };
m_networkInterface->GetConnectionSet().VisitConnections(visitor);
if (GetAgentType() == MultiplayerAgentType::DedicatedServer || GetAgentType() == MultiplayerAgentType::ClientServer)
MultiplayerAgentType agentType = GetAgentType();
if (agentType == MultiplayerAgentType::DedicatedServer || agentType == MultiplayerAgentType::ClientServer)
{
m_networkInterface->StopListening();
m_shutdownEvent.Signal(m_networkInterface);
@@ -227,7 +228,7 @@ namespace Multiplayer
InitializeMultiplayer(MultiplayerAgentType::Uninitialized);
// Signal session management, do this after uninitializing state
if (GetAgentType() == MultiplayerAgentType::DedicatedServer || GetAgentType() == MultiplayerAgentType::ClientServer)
if (agentType == MultiplayerAgentType::DedicatedServer || agentType == MultiplayerAgentType::ClientServer)
{
if (AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get() != nullptr)
{