Add ENet kick/connection disconnect impl

This commit is contained in:
Damian Korczowski
2021-05-29 19:50:28 +02:00
parent 61af4c94bd
commit 1e22d8e3f8

View File

@@ -144,7 +144,18 @@ void ENetDriver::Disconnect()
void ENetDriver::Disconnect(const NetworkConnection& connection)
{
// TODO: kick given connection (?)
const int connectionId = connection.ConnectionId;
void* peer = nullptr;
if(_peerMap.TryGet(connectionId, peer))
{
enet_peer_disconnect_now((ENetPeer*)_peer, 0);
_peerMap.Remove(connectionId);
}
else
{
LOG(Error, "Failed to kick connection({0}). ENetPeer not found!", connection.ConnectionId);
}
}
bool ENetDriver::PopEvent(NetworkEvent* eventPtr)