|
@@ -93,8 +93,8 @@ namespace NetSoakTest
|
|
|
static const AZStd::string_view s_networkInterfaceName("NetSoakNetworkInterface");
|
|
|
static const AZStd::string_view s_loopbackInterfaceName("NetSoakLoopbackInterface");
|
|
|
|
|
|
- AZ_CVAR(AZ::TimeMs, soak_latencyms, AZ::TimeMs(0), nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "Simulated connection quality latency");
|
|
|
- AZ_CVAR(AZ::TimeMs, soak_variancems, AZ::TimeMs(0), nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "Simulated connection quality variance");
|
|
|
+ AZ_CVAR(AZ::TimeMs, soak_latencyms, AZ::Time::ZeroTimeMs, nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "Simulated connection quality latency");
|
|
|
+ AZ_CVAR(AZ::TimeMs, soak_variancems, AZ::Time::ZeroTimeMs, nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "Simulated connection quality variance");
|
|
|
AZ_CVAR(uint16_t, soak_losspercentage, 0, nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "Simulated connection quality packet drop rate");
|
|
|
AZ_CVAR(AZ::CVarFixedString, soak_serveraddr, AZ::CVarFixedString("127.0.0.1"), nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "The address of the server or host to connect to");
|
|
|
AZ_CVAR(uint16_t, soak_port, 33450, nullptr, AZ::ConsoleFunctorFlags::DontReplicate, "The port that this soak test will bind to for game traffic");
|
|
@@ -103,7 +103,7 @@ namespace NetSoakTest
|
|
|
|
|
|
void NetSoakTestSystemComponent::Reflect(AZ::ReflectContext* context)
|
|
|
{
|
|
|
- if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
|
|
|
+ if (auto serialize = azrtti_cast<AZ::SerializeContext*>(context))
|
|
|
{
|
|
|
serialize->Class<NetSoakTestSystemComponent, AZ::Component>()
|
|
|
->Version(0)
|
|
@@ -176,7 +176,7 @@ namespace NetSoakTest
|
|
|
|
|
|
void NetSoakTestSystemComponent::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
|
|
|
{
|
|
|
- [[maybe_unused]] AZ::TimeMs elapsedMs = aznumeric_cast<AZ::TimeMs>(aznumeric_cast<int64_t>(deltaTime / 1000.0f));
|
|
|
+ [[maybe_unused]] auto elapsedMs = aznumeric_cast<AZ::TimeMs>(aznumeric_cast<int64_t>(deltaTime / 1000.0f));
|
|
|
|
|
|
NetSoakTestPackets::Small packet;
|
|
|
|
|
@@ -184,11 +184,11 @@ namespace NetSoakTest
|
|
|
{
|
|
|
connection.SendReliablePacket(packet);
|
|
|
|
|
|
- uint32_t rand_int = rand();
|
|
|
+ const uint32_t rand_int = rand();
|
|
|
if (rand_int % 10 == 1)
|
|
|
{
|
|
|
NetSoakTest::TestNetworkBuffer buffer = NetSoakTest::TestNetworkBuffer(NetSoakTest::MassiveBuffer);
|
|
|
- NetSoakTestPackets::Large* large = new NetSoakTestPackets::Large(buffer);
|
|
|
+ const NetSoakTestPackets::Large* large = new NetSoakTestPackets::Large(buffer);
|
|
|
connection.SendReliablePacket(*large);
|
|
|
delete large;
|
|
|
}
|
|
@@ -199,7 +199,7 @@ namespace NetSoakTest
|
|
|
unreliable.SetSmallDatum(2);
|
|
|
connection.SendUnreliablePacket(unreliable);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
};
|
|
|
|
|
|
m_networkInterface->GetConnectionSet().VisitConnections(visitor);
|
|
@@ -259,7 +259,6 @@ namespace NetSoakTest
|
|
|
|
|
|
void NetSoakTestSystemComponent::OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId)
|
|
|
{
|
|
|
- ;
|
|
|
}
|
|
|
|
|
|
void NetSoakTestSystemComponent::OnDisconnect(IConnection* connection, [[maybe_unused]] DisconnectReason reason, [[maybe_unused]] AzNetworking::TerminationEndpoint endpoint)
|
|
@@ -273,7 +272,7 @@ namespace NetSoakTest
|
|
|
networkInterfaces.push_back(AZ::Interface<INetworking>::Get()->RetrieveNetworkInterface(AZ::Name(s_networkInterfaceName)));
|
|
|
networkInterfaces.push_back(AZ::Interface<INetworking>::Get()->RetrieveNetworkInterface(AZ::Name(s_loopbackInterfaceName)));
|
|
|
|
|
|
- for (auto& networkInterface : networkInterfaces)
|
|
|
+ for (const auto& networkInterface : networkInterfaces)
|
|
|
{
|
|
|
const char* protocol = networkInterface->GetType() == ProtocolType::Tcp ? "Tcp" : "Udp";
|
|
|
const char* trustZone = networkInterface->GetTrustZone() == TrustZone::ExternalClientToServer ? "ExternalClientToServer" : "InternalServerToServer";
|