net.DebugDualIPs

net.DebugDualIPs

#Overview

name: net.DebugDualIPs

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.DebugDualIPs is to simulate the scenario of receiving client packets from dual IP addresses, which can occur under real-world network conditions. This setting is specifically designed for debugging and testing purposes in non-shipping builds of Unreal Engine.

This setting variable is primarily used in the Online Subsystem Utils plugin, specifically within the IP Net Driver module. It’s part of the networking system and is used to test and debug network-related issues.

The value of this variable is set through a console variable (CVarNetDebugDualIPs) with an initial value of 0 (disabled). It can be changed at runtime through console commands.

The associated variable CVarNetDebugDualIPs directly interacts with net.DebugDualIPs. They essentially represent the same setting, with CVarNetDebugDualIPs being the C++ implementation of the console variable.

Developers must be aware that:

  1. This setting is only available in non-shipping builds (#if !UE_BUILD_SHIPPING).
  2. It only supports simulating dual IPs for a single client on the server.
  3. Enabling this setting will duplicate every received packet and process it with a new, deterministic IP address.

Best practices when using this variable include:

  1. Only use it for debugging and testing purposes, never in production builds.
  2. Be cautious of performance implications, as it doubles the packet processing load.
  3. Use in conjunction with other networking debugging tools to isolate and identify specific issues related to dual IP scenarios.

Regarding the associated variable CVarNetDebugDualIPs:

Developers should use this variable judiciously and only when investigating specific networking issues related to dual IP scenarios, as it can significantly impact performance and behavior of the networking system.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpNetDriver.cpp:103

Scope: file

Source code excerpt:

#if !UE_BUILD_SHIPPING
TAutoConsoleVariable<int32> CVarNetDebugDualIPs(
	TEXT("net.DebugDualIPs"),
	0,
	TEXT("If true, will duplicate every packet received, and process with a new (deterministic) IP, ")
		TEXT("to emulate receiving client packets from dual IP's - which can happen under real-world network conditions")
		TEXT("(only supports a single client on the server)."));

TSharedPtr<FInternetAddr> GCurrentDuplicateIP;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpNetDriver.cpp:102

Scope: file

Source code excerpt:


#if !UE_BUILD_SHIPPING
TAutoConsoleVariable<int32> CVarNetDebugDualIPs(
	TEXT("net.DebugDualIPs"),
	0,
	TEXT("If true, will duplicate every packet received, and process with a new (deterministic) IP, ")
		TEXT("to emulate receiving client packets from dual IP's - which can happen under real-world network conditions")
		TEXT("(only supports a single client on the server)."));

#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpNetDriver.cpp:234

Scope (from outer to inner):

file
class        class FPacketIterator
function     FPacketIterator

Source code excerpt:

		, CurrentPacket()
#if !UE_BUILD_SHIPPING
		, bDebugDualIPs(CVarNetDebugDualIPs.GetValueOnAnyThread() != 0)
		, DuplicatePacket()
#endif
		, RMState(InRMState)
		, bUseRecvMulti(CVarNetUseRecvMulti.GetValueOnAnyThread() != 0 && InRMState != nullptr)
		, RecvMultiIdx(0)
		, RecvMultiPacketCount(0)