Fix host id issue, cleanup

This commit is contained in:
Damian Korczowski
2021-06-17 18:42:42 +02:00
parent e0d41ab683
commit f40bb309d5

View File

@@ -26,7 +26,7 @@ int NetworkManager::Initialize(const NetworkConfig& config)
ASSERT(config.Address == String("any") || isValidEndPoint);
// Alloc new host
const int hostId = Hosts.Count();
const int hostId = Hosts.Count(); // TODO: Maybe keep the host count under a limit? Maybe some drivers do not support this?
Hosts.Add(NetworkHost());
NetworkHost& host = Hosts.Last();
host.HostId = hostId;
@@ -42,7 +42,7 @@ void NetworkManager::Shutdown(const int hostId)
ASSERT(Hosts[hostId].IsValid());
NetworkHost& host = Hosts[hostId];
host.Shutdown();
Hosts.Remove(host);
// Hosts.Remove(host); // Do not remove hosts, because we need to keep the array unmodified to make the id's work
}
bool NetworkManager::Listen(const int hostId)