MessageBus.UDP.MaxRetriesForBadEndpoint

MessageBus.UDP.MaxRetriesForBadEndpoint

#Overview

name: MessageBus.UDP.MaxRetriesForBadEndpoint

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 MessageBus.UDP.MaxRetriesForBadEndpoint is to control the maximum number of retries that will be attempted when a socket connection fails to reach an endpoint in the UDP messaging system of Unreal Engine.

This setting variable is primarily used in the UdpMessaging plugin, which is part of the Unreal Engine’s messaging system. Specifically, it’s utilized in the UDP message transport module.

The value of this variable is set using a TAutoConsoleVariable, which means it can be adjusted at runtime through the console or configuration files. The default value is set to 5 retries.

The associated variable CVarMaxRetriesForBadEndpoint directly interacts with MessageBus.UDP.MaxRetriesForBadEndpoint. They share the same value and purpose.

Developers must be aware that this variable affects the reliability and performance of UDP-based message transport in the engine. Setting it too low might result in premature disconnections, while setting it too high could lead to unnecessary delays when dealing with genuinely unreachable endpoints.

Best practices when using this variable include:

  1. Adjusting it based on the network conditions of the target environment.
  2. Monitoring its impact on performance and connection stability.
  3. Considering the trade-off between connection persistence and responsiveness to network issues.

Regarding the associated variable CVarMaxRetriesForBadEndpoint:

It’s a TAutoConsoleVariable that directly represents MessageBus.UDP.MaxRetriesForBadEndpoint in the code. It’s used in the ShouldAllowEndpoint function to determine whether an endpoint should be allowed based on its failure count. If an endpoint’s failure count exceeds the value of CVarMaxRetriesForBadEndpoint, the endpoint is not allowed, potentially preventing further connection attempts to problematic endpoints.

Developers should be aware that changes to CVarMaxRetriesForBadEndpoint will immediately affect the behavior of the UDP message transport system. They should consider the impact on both server and client performance when adjusting this value.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Messaging/UdpMessaging/Source/UdpMessaging/Private/Transport/UdpMessageTransport.cpp:17

Scope: file

Source code excerpt:


TAutoConsoleVariable<int32> CVarMaxRetriesForBadEndpoint(
	TEXT("MessageBus.UDP.MaxRetriesForBadEndpoint"),
	5,
	TEXT("The maximum number of retries that will be attempted when a socket connection fails to reach an endpoint."),
	ECVF_Default
);

TAutoConsoleVariable<int32> CVarBadEndpointPeriod(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Messaging/UdpMessaging/Source/UdpMessaging/Private/Transport/UdpMessageTransport.cpp:16

Scope: file

Source code excerpt:

 *****************************************************************************/

TAutoConsoleVariable<int32> CVarMaxRetriesForBadEndpoint(
	TEXT("MessageBus.UDP.MaxRetriesForBadEndpoint"),
	5,
	TEXT("The maximum number of retries that will be attempted when a socket connection fails to reach an endpoint."),
	ECVF_Default
);

#Loc: <Workspace>/Engine/Plugins/Messaging/UdpMessaging/Source/UdpMessaging/Private/Transport/UdpMessageTransport.cpp:65

Scope (from outer to inner):

file
namespace    UE::UdpMessageTransport::Private
function     bool ShouldAllowEndpoint

Source code excerpt:

		FScopeLock DenyListLock(&DenyListCS);
		const FDenyCandidate* DenyCandidate = DenyCandidateList.Find(EndpointNodeId);
		if (DenyCandidate && DenyCandidate->EndpointFailureCount > CVarMaxRetriesForBadEndpoint.GetValueOnAnyThread())
		{
			return false;
		}
		return true;
	}