From 9c9d2c70f5c9593a4087d1d44499628b8db00f2d Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Mon, 29 Nov 2021 18:26:31 -0800 Subject: [PATCH] Making sure to stop pulling server logs before terminating the server process; otherwise we might be pulling an invalid process-communicator. Updating AZCoreLogSink to also allow for piping warnings/errors/asserts Signed-off-by: Gene Walters --- Code/Legacy/CrySystem/AZCoreLogSink.h | 6 +++--- .../Source/Editor/MultiplayerEditorSystemComponent.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Code/Legacy/CrySystem/AZCoreLogSink.h b/Code/Legacy/CrySystem/AZCoreLogSink.h index 39a6131262..9d732b3dd4 100644 --- a/Code/Legacy/CrySystem/AZCoreLogSink.h +++ b/Code/Legacy/CrySystem/AZCoreLogSink.h @@ -127,7 +127,7 @@ public: CryLogAlways("%s", message); } - return true; // suppress default AzCore behavior. + return m_suppressSystemOutput; #else AZ_UNUSED(fileName); AZ_UNUSED(line); @@ -147,7 +147,7 @@ public: return false; // allow AZCore to do its default behavior. } gEnv->pLog->LogError("(%s) - %s", window, message); - return true; // suppress default AzCore behavior. + return m_suppressSystemOutput; } bool OnPreWarning(const char* window, const char* fileName, int line, const char* func, const char* message) override @@ -162,7 +162,7 @@ public: } CryWarning(VALIDATOR_MODULE_UNKNOWN, VALIDATOR_WARNING, "(%s) - %s", window, message); - return true; // suppress default AzCore behavior. + return m_suppressSystemOutput; } bool OnOutput(const char* window, const char* message) override diff --git a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp index 7cc6fbc1b5..fa855cf28c 100644 --- a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorSystemComponent.cpp @@ -160,6 +160,7 @@ namespace Multiplayer [[fallthrough]]; case eNotify_OnEndGameMode: // Kill the configured server if it's active + AZ::TickBus::Handler::BusDisconnect(); if (m_serverProcessWatcher) { m_serverProcessWatcher->TerminateProcess(0); @@ -172,9 +173,7 @@ namespace Multiplayer m_serverProcessWatcher = nullptr; m_serverProcessTracePrinter = nullptr; } - - AZ::TickBus::Handler::BusDisconnect(); - + if (INetworkInterface* editorNetworkInterface = AZ::Interface::Get()->RetrieveNetworkInterface(AZ::Name(MpEditorInterfaceName))) { editorNetworkInterface->Disconnect(m_editorConnId, AzNetworking::DisconnectReason::TerminatedByClient); @@ -251,10 +250,12 @@ namespace Multiplayer // Stop the previous server if one exists if (m_serverProcessWatcher) { + AZ::TickBus::Handler::BusDisconnect(); m_serverProcessWatcher->TerminateProcess(0); } m_serverProcessWatcher.reset(outProcess); m_serverProcessTracePrinter = AZStd::make_unique(m_serverProcessWatcher->GetCommunicator(), "EditorServer"); + AZ::TickBus::Handler::BusConnect(); } void MultiplayerEditorSystemComponent::OnGameEntitiesStarted() @@ -315,7 +316,6 @@ namespace Multiplayer // Launch the editor-server LaunchEditorServer(); - AZ::TickBus::Handler::BusConnect(); } else {