Merge pull request #5359 from aws-lumberyard-dev/LYN-8035_MultiplayerFlakyTest_ServerLogging

Wait to Activate Editor-server Until the Logging System is Ready
This commit is contained in:
puvvadar
2021-11-08 12:10:37 -08:00
committed by GitHub
2 changed files with 24 additions and 6 deletions
@@ -20,6 +20,8 @@
#include <AzCore/Serialization/Utils.h>
#include <AzNetworking/ConnectionLayer/IConnection.h>
#include <AzNetworking/Framework/INetworking.h>
#include <AzCore/Console/IConsole.h>
#include <AzCore/Component/ComponentApplicationLifecycle.h>
namespace Multiplayer
{
@@ -34,9 +36,27 @@ namespace Multiplayer
m_networkEditorInterface = AZ::Interface<INetworking>::Get()->CreateNetworkInterface(
AZ::Name(MpEditorInterfaceName), ProtocolType::Tcp, TrustZone::ExternalClientToServer, *this);
m_networkEditorInterface->SetTimeoutMs(AZ::TimeMs{ 0 }); // Disable timeouts on this network interface
ActivateDedicatedEditorServer();
}
// Wait to activate the editor-server until LegacySystemInterfaceCreated so that the logging system is ready
// Automated testing listens for these logs
if (editorsv_isDedicated)
{
// If the settings registry is not available at this point,
// then something catastrophic has happened in the application startup.
// That should have been caught and messaged out earlier in startup.
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
{
AZ::ComponentApplicationLifecycle::RegisterHandler(
*settingsRegistry, m_componentApplicationLifecycleHandler,
[this](AZStd::string_view /*path*/, AZ::SettingsRegistryInterface::Type /*type*/)
{
ActivateDedicatedEditorServer();
},
"LegacySystemInterfaceCreated");
}
}
}
void MultiplayerEditorConnection::ActivateDedicatedEditorServer() const
{
if (m_isActivated || !editorsv_isDedicated)
@@ -9,12 +9,9 @@
#pragma once
#include <Source/AutoGen/MultiplayerEditor.AutoPacketDispatcher.h>
#include <AzCore/Console/IConsole.h>
#include <AzCore/Console/ILogger.h>
#include <AzCore/IO/ByteContainerStream.h>
#include <AzCore/std/string/string.h>
#include <AzNetworking/ConnectionLayer/IConnectionListener.h>
#include <AzCore/Settings/SettingsRegistry.h>
namespace AzNetworking
{
@@ -51,5 +48,6 @@ namespace Multiplayer
AZStd::vector<uint8_t> m_buffer;
AZ::IO::ByteContainerStream<AZStd::vector<uint8_t>> m_byteStream;
mutable bool m_isActivated = false;
AZ::SettingsRegistryInterface::NotifyEventHandler m_componentApplicationLifecycleHandler;
};
}