join thread before cleanup

This commit is contained in:
john30
2017-01-07 14:23:14 +01:00
parent baa75f6ead
commit 63e5cb3105
+1 -1
View File
@@ -171,6 +171,7 @@ Network::Network(const bool local, const uint16_t port, const uint16_t httpPort,
Network::~Network() Network::~Network()
{ {
stop(); stop();
join();
while (!m_connections.empty()) { while (!m_connections.empty()) {
Connection* connection = m_connections.back(); Connection* connection = m_connections.back();
@@ -179,7 +180,6 @@ Network::~Network()
connection->join(); connection->join();
delete connection; delete connection;
} }
join();
if (m_tcpServer != NULL) { if (m_tcpServer != NULL) {
delete m_tcpServer; delete m_tcpServer;