net.RPCDoSScopeDebugging
net.RPCDoSScopeDebugging
#Overview
name: net.RPCDoSScopeDebugging
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Sets whether or not debugging/ensures for RPC DoS Tick/Packet scopes should be enabled.
It is referenced in 12
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.RPCDoSScopeDebugging is to control whether debugging and ensures for RPC DoS (Denial of Service) Tick/Packet scopes should be enabled. This setting is primarily used for debugging and ensuring the correct functionality of the RPC DoS detection system in Unreal Engine’s networking subsystem.
-
The Unreal Engine networking subsystem, specifically the RPC DoS detection module, relies on this setting variable.
-
The value of this variable is set through the FAutoConsoleVariableRef CVarRPCDoSScopeDebugging, which allows it to be modified at runtime via console commands.
-
This variable interacts closely with GRPCDoSScopeDebugging, which is the actual integer variable that stores the value. The console variable net.RPCDoSScopeDebugging is linked to GRPCDoSScopeDebugging.
-
Developers must be aware that enabling this variable (setting it to a non-zero value) will activate additional debug checks and ensure statements throughout the RPC DoS detection code. This can be useful for debugging but may impact performance in development builds.
-
Best practices when using this variable include:
- Only enable it when actively debugging RPC DoS detection issues.
- Be prepared for potential performance impacts when enabled.
- Use in conjunction with other networking debugging tools for comprehensive analysis.
Regarding the associated variable GRPCDoSScopeDebugging:
The purpose of GRPCDoSScopeDebugging is to store the actual value that determines whether RPC DoS scope debugging is enabled. It is an integer variable that is directly accessed in the code to perform debug checks.
-
This variable is used throughout the FRPCDoSDetection class to conditionally execute ensure statements that verify the correct state of various scopes (Tick, Packet, and SequentialRPC) during RPC processing.
-
The value of GRPCDoSScopeDebugging is set indirectly through the console variable net.RPCDoSScopeDebugging.
-
It interacts closely with the console variable net.RPCDoSScopeDebugging and is used in multiple ensure statements throughout the RPC DoS detection code.
-
Developers should be aware that this variable is used in preprocessor conditionals (#if RPC_DOS_SCOPE_DEBUG), so its effects are only present in builds where RPC_DOS_SCOPE_DEBUG is defined.
-
Best practices for using GRPCDoSScopeDebugging include:
- Avoid modifying it directly in code; instead, use the console variable to change its value.
- When debugging RPC DoS issues, check its value to ensure debugging is correctly enabled or disabled as needed.
- Be mindful of the performance impact when enabled, especially in development builds.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:79
Scope (from outer to inner):
file
namespace UE::Net
Source code excerpt:
FAutoConsoleVariableRef CVarRPCDoSScopeDebugging(
TEXT("net.RPCDoSScopeDebugging"),
GRPCDoSScopeDebugging,
TEXT("Sets whether or not debugging/ensures for RPC DoS Tick/Packet scopes should be enabled."));
}
#endif
#Associated Variable and Callsites
This variable is associated with another variable named GRPCDoSScopeDebugging
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:76
Scope (from outer to inner):
file
namespace UE::Net
Source code excerpt:
namespace UE::Net
{
int32 GRPCDoSScopeDebugging = 0;
FAutoConsoleVariableRef CVarRPCDoSScopeDebugging(
TEXT("net.RPCDoSScopeDebugging"),
GRPCDoSScopeDebugging,
TEXT("Sets whether or not debugging/ensures for RPC DoS Tick/Packet scopes should be enabled."));
}
#endif
/**
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:996
Scope (from outer to inner):
file
function void FRPCDoSDetection::PostReceivedRPCPacket
Source code excerpt:
#if RPC_DOS_SCOPE_DEBUG
// If this ensure fails, there is the potential for a crash - seen very rarely, and the Tick/Packet/SequentialRPC scoping should eliminate it
ensure(GRPCDoSScopeDebugging == 0 || (RPCTracking.Num() > 0 && ActiveRPCTracking.Num() > 0));
#endif
if (RPCTracking.Num() > 0 && ActiveRPCTracking.Num() > 0)
{
PostSequentialRPC(EPostSequentialRPCType::PostPacket, TimeSeconds, SequentialRPCScope.PostReceivedRPCCounter,
SequentialRPCScope.PostReceivedRPCTracking);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:1013
Scope (from outer to inner):
file
function void FRPCDoSDetection::PostReceivedRPCPacket
Source code excerpt:
#if RPC_DOS_SCOPE_DEBUG
ensure(GRPCDoSScopeDebugging == 0 || SequentialRPCScopePrivate.IsActive());
ensure(GRPCDoSScopeDebugging == 0 || PacketScopePrivate.IsActive());
ensure(GRPCDoSScopeDebugging == 0 || TickScopePrivate.IsActive());
#endif
SequentialRPCScopePrivate.SetActive(false);
}
void FRPCDoSDetection::PostTickDispatch()
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:50
Scope (from outer to inner):
file
namespace UE::Net
Source code excerpt:
{
/** Whether or not debugging/ensures for RPC DoS Tick/Packet scopes should be enabled */
extern int32 GRPCDoSScopeDebugging;
}
#endif
// Structs
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:499
Scope (from outer to inner):
file
class class FRPCDoSDetection : protected FRPCDoSState
function void PreReceivedPacket
Source code excerpt:
#if RPC_DOS_SCOPE_DEBUG
ensure(GRPCDoSScopeDebugging == 0 || TickScopePrivate.IsActive());
ensure(GRPCDoSScopeDebugging == 0 || !SequentialRPCScopePrivate.IsActive());
#endif
PacketScopePrivate.SetActive(true);
FPacketScope& PacketScope = GetPacketScope();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:664
Scope (from outer to inner):
file
class class FRPCDoSDetection : protected FRPCDoSState
function void PostReceivedPacket
Source code excerpt:
#if RPC_DOS_SCOPE_DEBUG
ensure(GRPCDoSScopeDebugging == 0 || !SequentialRPCScopePrivate.IsActive());
ensure(GRPCDoSScopeDebugging == 0 || TickScopePrivate.IsActive());
#endif
}
/**
* Called after the current NetConnection receives a packet, when RPC DoS Detection is active and the packet contains an RPC.
* NOTE: Timing is approximate - may include multiple-RPC and non-RPC packet processing time - but low cost
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:741
Scope (from outer to inner):
file
class class FRPCDoSDetection : protected FRPCDoSState
function void PreSequentialRPC
Source code excerpt:
#if RPC_DOS_SCOPE_DEBUG
ensure(GRPCDoSScopeDebugging == 0 || TickScopePrivate.IsActive());
ensure(GRPCDoSScopeDebugging == 0 || PacketScopePrivate.IsActive());
#endif
SequentialRPCScopePrivate.SetActive(true);
}
/**
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:918
Scope (from outer to inner):
file
class class FRPCDoSDetection : protected FRPCDoSState
class class TScopeBase
function inline void SetActive
Source code excerpt:
#if RPC_DOS_SCOPE_DEBUG
ensure(GRPCDoSScopeDebugging == 0 || bScopeActive != bInVal);
#endif
bScopeActive = bInVal;
Reset();
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:985
Scope (from outer to inner):
file
class class FRPCDoSDetection : protected FRPCDoSState
function inline FTickScope& GetTickScope
Source code excerpt:
#if RPC_DOS_SCOPE_DEBUG
ensure(GRPCDoSScopeDebugging == 0 || TickScopePrivate.IsActive());
#endif
return TickScopePrivate;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:1021
Scope (from outer to inner):
file
class class FRPCDoSDetection : protected FRPCDoSState
function inline FPacketScope& GetPacketScope
Source code excerpt:
#if RPC_DOS_SCOPE_DEBUG
ensure(GRPCDoSScopeDebugging == 0 || PacketScopePrivate.IsActive());
#endif
return PacketScopePrivate;
}
/** Variables and functions that should only be accessible while receiving the same RPC individually/sequentially */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:1116
Scope (from outer to inner):
file
class class FRPCDoSDetection : protected FRPCDoSState
function inline FSequentialRPCScope& GetSequentialRPCScope
Source code excerpt:
#if RPC_DOS_SCOPE_DEBUG
ensure(GRPCDoSScopeDebugging == 0 || SequentialRPCScopePrivate.IsActive());
#endif
return SequentialRPCScopePrivate;
}