Removed Close method from Client, Server and Network.
Removed legacy variable m_ThreadIsRunning in Client.h and Server.h. Removed m_EventBroker->Unsubscribe(m_EInputCommand) in Client destructor.
This commit is contained in:
@@ -23,7 +23,6 @@ public:
|
|||||||
~Client();
|
~Client();
|
||||||
void Start(World* world, EventBroker* eventBroker) override;
|
void Start(World* world, EventBroker* eventBroker) override;
|
||||||
void Update() override;
|
void Update() override;
|
||||||
void Close();
|
|
||||||
private:
|
private:
|
||||||
// Assio UDP logic
|
// Assio UDP logic
|
||||||
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||||
@@ -49,7 +48,6 @@ private:
|
|||||||
// Network logic
|
// Network logic
|
||||||
PlayerDefinition m_PlayerDefinitions[MAXCONNECTIONS];
|
PlayerDefinition m_PlayerDefinitions[MAXCONNECTIONS];
|
||||||
SnapshotDefinitions m_NextSnapshot;
|
SnapshotDefinitions m_NextSnapshot;
|
||||||
bool m_ThreadIsRunning = true;
|
|
||||||
double m_DurationOfPingTime;
|
double m_DurationOfPingTime;
|
||||||
std::clock_t m_StartPingTime;
|
std::clock_t m_StartPingTime;
|
||||||
// Use to check if we should send disconnect message
|
// Use to check if we should send disconnect message
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ public:
|
|||||||
virtual ~Network() { };
|
virtual ~Network() { };
|
||||||
virtual void Start(World* m_world, EventBroker *eventBroker) = 0;
|
virtual void Start(World* m_world, EventBroker *eventBroker) = 0;
|
||||||
virtual void Update() = 0;
|
virtual void Update() = 0;
|
||||||
virtual void Close() = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -20,8 +20,6 @@ public:
|
|||||||
~Server();
|
~Server();
|
||||||
void Start(World* m_world, EventBroker *eventBroker) override;
|
void Start(World* m_world, EventBroker *eventBroker) override;
|
||||||
void Update() override;
|
void Update() override;
|
||||||
void Close();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// UDP logic
|
// UDP logic
|
||||||
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||||
@@ -56,9 +54,6 @@ private:
|
|||||||
unsigned int m_PreviousPacketID;
|
unsigned int m_PreviousPacketID;
|
||||||
unsigned int m_SendPacketID;
|
unsigned int m_SendPacketID;
|
||||||
|
|
||||||
// Close logic
|
|
||||||
bool m_ThreadIsRunning = true;
|
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
int receive(char* data, size_t length);
|
int receive(char* data, size_t length);
|
||||||
void readFromClients();
|
void readFromClients();
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ Client::Client(ConfigFile* config) : m_Socket(m_IOService)
|
|||||||
|
|
||||||
Client::~Client()
|
Client::~Client()
|
||||||
{
|
{
|
||||||
m_EventBroker->Unsubscribe(m_EInputCommand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Start(World* world, EventBroker* eventBroker)
|
void Client::Start(World* world, EventBroker* eventBroker)
|
||||||
@@ -38,14 +37,6 @@ void Client::Update()
|
|||||||
readFromServer();
|
readFromServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Close()
|
|
||||||
{
|
|
||||||
disconnect();
|
|
||||||
m_ThreadIsRunning = false;
|
|
||||||
m_Socket.close();
|
|
||||||
m_EventBroker->Unsubscribe(m_EInputCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Client::readFromServer()
|
void Client::readFromServer()
|
||||||
{
|
{
|
||||||
while (m_Socket.available()) {
|
while (m_Socket.available()) {
|
||||||
|
|||||||
@@ -24,12 +24,6 @@ void Server::Update()
|
|||||||
readFromClients();
|
readFromClients();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::Close()
|
|
||||||
{
|
|
||||||
m_ThreadIsRunning = false;
|
|
||||||
m_Socket.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Server::readFromClients()
|
void Server::readFromClients()
|
||||||
{
|
{
|
||||||
while (m_Socket.available()) {
|
while (m_Socket.available()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user