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 <genewalt@amazon.com>
This commit is contained in:
Gene Walters
2021-11-29 18:26:31 -08:00
parent 77e3dd786d
commit 9c9d2c70f5
2 changed files with 7 additions and 7 deletions
@@ -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<INetworking>::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<ProcessCommunicatorTracePrinter>(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
{