fix for potentially skipped entries in cleanConnections()

This commit is contained in:
john30
2017-04-22 11:33:37 +02:00
parent de456b3774
commit 62bab7d280
+4 -2
View File
@@ -291,13 +291,15 @@ void Network::run() {
}
void Network::cleanConnections() {
list<Connection*>::iterator c_it;
for (c_it = m_connections.begin(); c_it != m_connections.end(); c_it++) {
list<Connection*>::iterator c_it = m_connections.begin();
while (c_it != m_connections.end()) {
if (!(*c_it)->isRunning()) {
Connection* connection = *c_it;
c_it = m_connections.erase(c_it);
delete connection;
logDebug(lf_network, "dead connection removed - %d", m_connections.size());
} else {
c_it++;
}
}
}