Add usage of address specified in config for ENet driver

This commit is contained in:
Damian Korczowski
2021-05-29 19:42:22 +02:00
parent 6719e0b326
commit 61af4c94bd

View File

@@ -82,8 +82,12 @@ void ENetDriver::Dispose()
bool ENetDriver::Listen()
{
ENetAddress address = {0};
address.host = ENET_HOST_ANY; // TODO
address.port = _config.Port;
address.host = ENET_HOST_ANY;
// Set host address if needed
if(_config.Address != String("any"))
enet_address_set_host(&address, _config.Address.ToStringAnsi().GetText());
// Create ENet host
_host = enet_host_create(&address, _config.ConnectionsLimit, 1, 0, 0);
@@ -103,7 +107,7 @@ bool ENetDriver::Connect()
ENetAddress address = {0};
address.port = _config.Port;
enet_address_set_host(&address, "127.0.0.1"); // TODO
enet_address_set_host(&address, _config.Address.ToStringAnsi().GetText());
// Create ENet host
_host = enet_host_create(nullptr, 1, 1, 0, 0);