fully implement KeepAlive behavior
This commit is contained in:
@@ -1,18 +1,13 @@
|
||||
#include <blitz/network/EnetClient.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace blitz {
|
||||
namespace network {
|
||||
|
||||
|
||||
|
||||
|
||||
EnetClient::EnetClient(const Nz::IpAddress& address) : m_Running(true) {
|
||||
m_Host.Create(Nz::IpAddress::LoopbackIpV4, 1);
|
||||
m_Peer = m_Host.Connect(address);
|
||||
m_Thread = std::thread(&EnetClient::WorkerThread, this);
|
||||
m_Connexion.SetPeer(m_Peer);
|
||||
m_Connection.SetPeer(m_Peer);
|
||||
}
|
||||
|
||||
EnetClient::~EnetClient() {
|
||||
@@ -25,7 +20,7 @@ EnetClient::~EnetClient() {
|
||||
|
||||
void EnetClient::Disconnect() {
|
||||
m_Peer->DisconnectNow(0);
|
||||
m_Connexion.SetPeer(nullptr);
|
||||
m_Connection.SetPeer(nullptr);
|
||||
}
|
||||
|
||||
void EnetClient::WorkerThread() {
|
||||
@@ -53,7 +48,7 @@ void EnetClient::Update() {
|
||||
break;
|
||||
|
||||
case Nz::ENetEventType::Receive:
|
||||
m_Connexion.Recieve(event.packet.m_packet->data);
|
||||
m_Connection.Recieve(event.packet.m_packet->data);
|
||||
break;
|
||||
|
||||
case Nz::ENetEventType::None:
|
||||
|
||||
Reference in New Issue
Block a user