net.NetPingTimeoutDisableThreshold

net.NetPingTimeoutDisableThreshold

#Overview

name: net.NetPingTimeoutDisableThreshold

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of net.NetPingTimeoutDisableThreshold is to control the network ping system’s behavior in handling consecutive ping failures. It is used in the network subsystem of Unreal Engine to manage the reliability of network connections.

This setting variable is primarily used in the Engine’s networking module, specifically in the Net subsystem. Based on the callsites, it’s part of the ping management system that helps monitor network connectivity.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 15, but can be changed at runtime through console commands or configuration files.

The associated variable CVarNetPingTimeoutDisableThreshold directly interacts with net.NetPingTimeoutDisableThreshold. They share the same value and purpose.

Developers must be aware that this variable determines when the engine will stop attempting to ping a network endpoint after consecutive failures. If the number of ping timeouts reaches this threshold, the engine will disable pings to that endpoint.

Best practices when using this variable include:

  1. Adjusting the value based on the specific network conditions of your game. A higher value might be more suitable for less stable networks, while a lower value could be used in more reliable environments.
  2. Monitoring this value in conjunction with other network metrics to ensure optimal performance.
  3. Consider logging or alerting when this threshold is reached, as it might indicate significant network issues.

Regarding the associated variable CVarNetPingTimeoutDisableThreshold:

The purpose of CVarNetPingTimeoutDisableThreshold is identical to net.NetPingTimeoutDisableThreshold. It’s the actual console variable that controls the threshold.

This variable is used in the Engine’s networking module, specifically in the ping management system within the Net subsystem.

The value is set when the CVar is initialized, but can be changed at runtime through console commands.

It directly interacts with net.NetPingTimeoutDisableThreshold, as they represent the same setting.

Developers should be aware that this is the actual variable used in the code to check against the threshold. It’s accessed using GetValueOnAnyThread() method, which suggests it can be safely read from multiple threads.

Best practices include using this variable consistently throughout the codebase when referring to the ping timeout disable threshold, and considering thread safety when modifying its value at runtime.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/NetPing.cpp:59

Scope (from outer to inner):

file
namespace    UE::Net

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNetPingTimeoutDisableThreshold(
	TEXT("net.NetPingTimeoutDisableThreshold"), 15,
	TEXT("The number of times to send an ICMP/UDP ping when at a failure/timeout rate of 100%, before giving up and disabling pings."));

#if !UE_BUILD_SHIPPING
static int32 GNetPingDebugDump = 0;

static FAutoConsoleVariableRef CVarNetPingDebugDump(

#Associated Variable and Callsites

This variable is associated with another variable named CVarNetPingTimeoutDisableThreshold. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/NetPing.cpp:58

Scope (from outer to inner):

file
namespace    UE::Net

Source code excerpt:

	TEXT("For 'UDPQoS' ping type, sets the port used for pinging."));

static TAutoConsoleVariable<int32> CVarNetPingTimeoutDisableThreshold(
	TEXT("net.NetPingTimeoutDisableThreshold"), 15,
	TEXT("The number of times to send an ICMP/UDP ping when at a failure/timeout rate of 100%, before giving up and disabling pings."));

#if !UE_BUILD_SHIPPING
static int32 GNetPingDebugDump = 0;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/NetPing.cpp:533

Scope (from outer to inner):

file
namespace    UE::Net
function     void FNetPing::UpdatePingTimeout

Source code excerpt:


		if (CurStorageBase.PingTimeouts == CurStorageBase.PingCount &&
			CurStorageBase.PingTimeouts >= static_cast<uint32>(CVarNetPingTimeoutDisableThreshold.GetValueOnAnyThread()))
		{
			FString FailureAddress;

			if (PingType == EPingType::ICMP)
			{
				FailureAddress = GetICMPAddr();