RPCRepeatLimitTimePeriod

RPCRepeatLimitTimePeriod

#Overview

name: RPCRepeatLimitTimePeriod

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of RPCRepeatLimitTimePeriod is to define a time period for measuring and limiting excessive RPC (Remote Procedure Call) executions in Unreal Engine’s networking system. It is part of the RPC Denial of Service (DoS) detection and prevention mechanism.

This setting variable is primarily used by the RPC DoS detection subsystem within Unreal Engine’s networking module. It is referenced in the FRPCDoSState and FRPCDoSStateConfig structures, which are responsible for managing and enforcing RPC execution limits.

The value of this variable is typically set in the engine’s configuration files or through code. It can be modified at runtime through the FRPCDoSStateConfig::ApplyState function.

RPCRepeatLimitTimePeriod interacts with several other variables, including:

Developers should be aware that:

  1. The value of RPCRepeatLimitTimePeriod is used to determine whether RPC tracking and limiting should be enabled.
  2. It is part of a larger system that prevents potential DoS attacks through excessive RPC calls.
  3. A value of -1 disables this specific limit.

Best practices when using this variable include:

  1. Carefully consider the appropriate time period for your game’s networking requirements.
  2. Use in conjunction with other RPC limiting variables for comprehensive DoS protection.
  3. Monitor and adjust based on real-world performance and security needs.
  4. Ensure that legitimate gameplay is not negatively impacted by overly restrictive settings.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:1774, section: [RPCDoSDetection.DoS]

Location: <Workspace>/Engine/Config/BaseEngine.ini:1790, section: [RPCDoSDetection.ExpensiveDoS]

#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:125

Scope (from outer to inner):

file
function     void FRPCDoSState::ApplyImpliedValues

Source code excerpt:

{
	EscalateQuotaTimePeriod = (EscalateQuotaRPCsPerPeriod != -1 || EscalateTimeQuotaMSPerPeriod != -1) ? EscalateQuotaTimePeriod : -1;
	RPCRepeatLimitTimePeriod = (RPCRepeatLimitPerPeriod != -1 || RPCRepeatLimitMSPerPeriod != -1) ? RPCRepeatLimitTimePeriod : -1;

	bTrackRecentRPCs = bTrackRecentRPCs || (RPCRepeatLimitPerPeriod != -1 && RPCRepeatLimitTimePeriod != -1);
	EscalateTimeQuotaSecsPerFrame = (EscalateTimeQuotaMSPerFrame != -1 ? (EscalateTimeQuotaMSPerFrame / 1000.0) : 0.0);
	EscalateTimeQuotaSecsPerPeriod = (EscalateTimeQuotaMSPerPeriod != -1 ? (EscalateTimeQuotaMSPerPeriod / 1000.0) : 0.0);
	RPCRepeatLimitSecsPerPeriod = (RPCRepeatLimitMSPerPeriod != -1 ? (RPCRepeatLimitMSPerPeriod / 1000.0) : 0.0);
	EscalationTimeToleranceSeconds = (EscalationTimeToleranceMS != -1 ? (EscalationTimeToleranceMS / 1000.0) : 0.0);
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:218

Scope (from outer to inner):

file
function     void FRPCDoSStateConfig::ApplyImpliedValues

Source code excerpt:

	}

	if (RPCRepeatLimitTimePeriod > 0)
	{
		AllTimePeriods.AddUnique(RPCRepeatLimitTimePeriod);
	}

	HighestTimePeriod = FMath::Max(AllTimePeriods);
}

bool FRPCDoSStateConfig::LoadStructConfig(const TCHAR* SectionName, const TCHAR* InFilename/*=nullptr*/)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:288

Scope (from outer to inner):

file
function     void FRPCDoSStateConfig::ValidateConfig

Source code excerpt:

						(EscalateQuotaRPCsPerPeriod > 0 || EscalateTimeQuotaMSPerPeriod > 0));

	ValidateTimePeriod(RPCRepeatLimitTimePeriod, TEXT("RPCRepeatLimitTimePeriod"),
						(RPCRepeatLimitPerPeriod > 0 || RPCRepeatLimitMSPerPeriod > 0));

	if (AutoEscalateTime > 0 && AutoEscalateTime < CooloffTime)
	{
		UE_LOG(LogNet, Warning, TEXT("FRPCDoSStateConfig: AutoEscalateTime must be larger than CooloffTime."));
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:320

Scope (from outer to inner):

file
function     void FRPCDoSStateConfig::ApplyState

Source code excerpt:

	Target.RPCRepeatLimitPerPeriod			= RPCRepeatLimitPerPeriod;
	Target.RPCRepeatLimitMSPerPeriod		= RPCRepeatLimitMSPerPeriod;
	Target.RPCRepeatLimitTimePeriod			= RPCRepeatLimitTimePeriod;
	Target.CooloffTime						= CooloffTime;
	Target.AutoEscalateTime					= AutoEscalateTime;

	Target.ApplyImpliedValues();
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Net/RPCDoSDetection.cpp:1174

Scope (from outer to inner):

file
function     ERPCNotifyResult FRPCDoSDetection::CheckRPCTracking

Source code excerpt:

				};

			const bool bBlockRPC = GAllowRPCDoSDetectionBlocking == 1 && RPCRepeatLimitTimePeriod != -1 &&
									HasHitQuota(RPCRepeatLimitTimePeriod, RPCRepeatLimitPerPeriod, RPCRepeatLimitSecsPerPeriod);

			Tracking.BlockState = bBlockRPC ? ERPCBlockState::Blocked : ERPCBlockState::NotBlocked;
		}

		if (Tracking.BlockState == ERPCBlockState::Blocked)
		{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/Net/RPCDoSDetection.h:234

Scope: file

Source code excerpt:

	/** The time period to use for measuring excessive execution time for a single RPC (Max: 16) */
	UPROPERTY(config)
	int8 RPCRepeatLimitTimePeriod		= -1;


	/** The amount of time, in seconds, before the current DoS severity category cools off and de-escalates */
	UPROPERTY(config)
	int16 CooloffTime					= -1;