Concert.Replication.SimulateJoinTimeouts

Concert.Replication.SimulateJoinTimeouts

#Overview

name: Concert.Replication.SimulateJoinTimeouts

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 Concert.Replication.SimulateJoinTimeouts is to simulate join request timeouts in the Concert replication system. This setting variable is used for testing and debugging purposes, allowing developers to simulate network issues without actually having network problems.

This setting variable is primarily used in the Concert Sync Client module, which is part of the Concert plugin for Unreal Engine. The Concert plugin is designed for real-time collaboration and synchronization in multi-user environments.

The value of this variable is set as a console variable (CVar) with a default value of false. It can be changed at runtime through the console or configuration files.

The associated variable CVarSimulateJoinTimeouts directly interacts with Concert.Replication.SimulateJoinTimeouts. They share the same value and are used interchangeably in the code.

Developers must be aware that enabling this variable will cause all join requests to simulate a timeout, which can significantly affect the behavior of the Concert replication system. It should only be used for testing and debugging purposes, not in production environments.

Best practices when using this variable include:

  1. Only enable it temporarily for testing network error handling.
  2. Disable it before committing code or deploying to production.
  3. Use it in conjunction with other debugging tools to fully understand the impact of join request timeouts on the system.
  4. Document its usage clearly in test plans or debugging procedures.

Regarding the associated variable CVarSimulateJoinTimeouts:

The purpose of CVarSimulateJoinTimeouts is to provide a programmatic way to access and control the Concert.Replication.SimulateJoinTimeouts setting within the C++ code.

It is used in the ReplicationManagerState_Disconnected class, specifically in the JoinReplicationSession function. When CVarSimulateJoinTimeouts is true, the function immediately returns a simulated network error instead of attempting to join the replication session.

The value of CVarSimulateJoinTimeouts is set through the TAutoConsoleVariable template, which links it to the Concert.Replication.SimulateJoinTimeouts console variable.

Developers should be aware that changes to CVarSimulateJoinTimeouts will directly affect the behavior of the JoinReplicationSession function and potentially other parts of the replication system.

Best practices for using CVarSimulateJoinTimeouts include:

  1. Use GetValueOnGameThread() to access its value, ensuring thread-safe access.
  2. Consider the performance impact of frequently checking this variable in critical code paths.
  3. Use it in combination with other debugging tools to fully understand the replication join process.
  4. Remember to reset it to false after testing to ensure normal operation of the replication system.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Developer/Concert/ConcertSync/ConcertSyncClient/Source/ConcertSyncClient/Private/Replication/Manager/ReplicationManagerState_Disconnected.cpp:10

Scope (from outer to inner):

file
namespace    UE::ConcertSyncClient::Replication

Source code excerpt:

{
	TAutoConsoleVariable<bool> CVarSimulateJoinTimeouts(
		TEXT("Concert.Replication.SimulateJoinTimeouts"),
		false,
		TEXT("Whether the client should pretend that join requests timed out instead of sending to the server.")
		);
	
	FReplicationManagerState_Disconnected::FReplicationManagerState_Disconnected(
		TSharedRef<IConcertClientSession> LiveSession,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Developer/Concert/ConcertSync/ConcertSyncClient/Source/ConcertSyncClient/Private/Replication/Manager/ReplicationManagerState_Disconnected.cpp:9

Scope (from outer to inner):

file
namespace    UE::ConcertSyncClient::Replication

Source code excerpt:

namespace UE::ConcertSyncClient::Replication
{
	TAutoConsoleVariable<bool> CVarSimulateJoinTimeouts(
		TEXT("Concert.Replication.SimulateJoinTimeouts"),
		false,
		TEXT("Whether the client should pretend that join requests timed out instead of sending to the server.")
		);
	
	FReplicationManagerState_Disconnected::FReplicationManagerState_Disconnected(

#Loc: <Workspace>/Engine/Plugins/Developer/Concert/ConcertSync/ConcertSyncClient/Source/ConcertSyncClient/Private/Replication/Manager/ReplicationManagerState_Disconnected.cpp:27

Scope (from outer to inner):

file
namespace    UE::ConcertSyncClient::Replication
function     TFuture<FJoinReplicatedSessionResult> FReplicationManagerState_Disconnected::JoinReplicationSession

Source code excerpt:

	TFuture<FJoinReplicatedSessionResult> FReplicationManagerState_Disconnected::JoinReplicationSession(FJoinReplicatedSessionArgs Args)
	{
		if (CVarSimulateJoinTimeouts.GetValueOnGameThread())
		{
			return MakeFulfilledPromise<FJoinReplicatedSessionResult>(FJoinReplicatedSessionResult{ EJoinReplicationErrorCode::NetworkError }).GetFuture();
		}
		
		TPromise<FJoinReplicatedSessionResult> JoinPromise;
		TFuture<FJoinReplicatedSessionResult> JoinFuture = JoinPromise.GetFuture();