Add INetworkDriver::DriverName() function

This commit is contained in:
Damian Korczowski
2021-10-12 18:19:23 +02:00
parent e717d29401
commit 9763199dbb
3 changed files with 12 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ DECLARE_SCRIPTING_TYPE(ENetDriver);
public:
// [INetworkDriver]
String DriverName() override { return String("ENetDriver"); }
void Initialize(NetworkPeer* host, const NetworkConfig& config) override;
void Dispose() override;
bool Listen() override;

View File

@@ -3,6 +3,7 @@
#pragma once
#include "Types.h"
#include "Engine/Core/Types/String.h"
#include "Engine/Scripting/ScriptingType.h"
/// <summary>
@@ -18,6 +19,14 @@ public:
/// </summary>
virtual ~INetworkDriver() = default;
/// <summary>
/// Return name of this network driver implementation.
/// </summary>
API_FUNCTION() virtual String DriverName()
{
return String("Unknown");
}
/// <summary>
/// Initializes the instance of this network driver using given configuration.
/// </summary>

View File

@@ -23,7 +23,7 @@ void NetworkPeer::Initialize(const NetworkConfig& config)
ASSERT(Config.NetworkDriver != nullptr);
ASSERT(Config.ConnectionsLimit > 0);
ASSERT(Config.MessageSize > 32); // TODO: Adjust this, not sure what the lowest limit should be.
ASSERT(Config.MessagePoolSize > 128);
ASSERT(Config.MessagePoolSize > 128);
// TODO: Dynamic message pool allocation
// Setup messages
@@ -38,7 +38,7 @@ void NetworkPeer::Initialize(const NetworkConfig& config)
NetworkDriver = ToInterface<INetworkDriver>(Config.NetworkDriver);
NetworkDriver->Initialize(this, Config);
LOG(Info, "NetworkManager initialized using driver = {0}", static_cast<int>(Config.NetworkDriverType));
LOG(Info, "NetworkManager initialized using driver = {0}", NetworkDriver->DriverName());
}
void NetworkPeer::Shutdown()