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