Merge Release-Engine-Staging to Main @ CL# 15151250

Represents UE4/Main @ 15133763

[CL 15158774 by Marc Audy in ue5-main branch]
This commit is contained in:
Marc Audy
2021-01-21 16:22:06 -04:00
parent daeebb2c6a
commit bc88b73a29
986 changed files with 29920 additions and 10663 deletions
@@ -96,6 +96,18 @@ void PacketHandler::Tick(float DeltaTime)
}
}
FPacketHandlerAddComponentByNameDelegate& PacketHandler::GetAddComponentByNameDelegate()
{
static FPacketHandlerAddComponentByNameDelegate AddComponentByNameDelegate;
return AddComponentByNameDelegate;
}
FPacketHandlerAddComponentDelegate& PacketHandler::GetAddComponentDelegate()
{
static FPacketHandlerAddComponentDelegate AddComponentDelegate;
return AddComponentDelegate;
}
void PacketHandler::Initialize(Handler::Mode InMode, uint32 InMaxPacketBits, bool bConnectionlessOnly/*=false*/,
TSharedPtr<IAnalyticsProvider> InProvider/*=nullptr*/, FDDoSDetection* InDDoS/*=nullptr*/, FName InDriverProfile/*=NAME_None*/)
{
@@ -103,8 +115,6 @@ void PacketHandler::Initialize(Handler::Mode InMode, uint32 InMaxPacketBits, boo
MaxPacketBits = InMaxPacketBits;
DDoS = InDDoS;
// @todo #JohnB: Redo this, so you don't load from the .ini at all, have it hardcoded elsewhere - do not want this in shipping.
bConnectionlessHandler = bConnectionlessOnly;
// Only UNetConnection's will load the .ini components, for now.
@@ -120,10 +130,23 @@ void PacketHandler::Initialize(Handler::Mode InMode, uint32 InMaxPacketBits, boo
GConfig->GetArray(TEXT("PacketHandlerComponents"), TEXT("Components"), Components, GEngineIni);
}
// Users of this delegate can add components to the list by name and if necessary reorder them
GetAddComponentByNameDelegate().ExecuteIfBound(Components);
for (const FString& CurComponent : Components)
{
AddHandler(CurComponent, true);
}
// Users of this delegate can supply constructed additional components to be added after the named components
TArray<TSharedPtr<HandlerComponent>> AdditionalComponents;
GetAddComponentDelegate().ExecuteIfBound(AdditionalComponents);
for (TSharedPtr<HandlerComponent> AdditionalComponent : AdditionalComponents)
{
AddHandler(AdditionalComponent, true);
}
}
// Add encryption component, if configured.
@@ -20,6 +20,7 @@ class ReliabilityHandlerComponent;
class FDDoSDetection;
class IAnalyticsProvider;
class FNetAnalyticsAggregator;
class PacketHandler;
/**
@@ -31,6 +32,10 @@ DECLARE_DELEGATE_ThreeParams(FPacketHandlerLowLevelSendTraits, void* /* Data */,
DECLARE_DELEGATE_ThreeParams(FPacketHandlerLowLevelSend, void* /* Data */, int32 /* CountBytes */, int32 /* CountBits */);
// Delegate for allowing adding of packet handlers without defining them in an ini file
DECLARE_DELEGATE_OneParam(FPacketHandlerAddComponentByNameDelegate, TArray<FString>& /* HandlerComponentNames */);
DECLARE_DELEGATE_OneParam(FPacketHandlerAddComponentDelegate, TArray<TSharedPtr<HandlerComponent>>& /* HandlerComponents*/ );
/**
* Callback for notifying higher-level code that handshaking has completed, and that packets are now ready to send without buffering
*/
@@ -605,6 +610,9 @@ public:
/** Mode of the handler, Client or Server */
Handler::Mode Mode;
static FPacketHandlerAddComponentByNameDelegate& GetAddComponentByNameDelegate();
static FPacketHandlerAddComponentDelegate& GetAddComponentDelegate();
private:
/** Whether or not this PacketHandler handles connectionless (i.e. non-UNetConnection) data */
bool bConnectionlessHandler;