zaphoyd/websocketpp — Issue #55: Policy Refactor: Correct fix of the issue's #50 endpoint::close_all problem
Author: megabyte1024
Created: 2012-01-24 10:02:33+00:00
State: open

In the issue #50 the 1st problem was linked with the endpoint::close_all method. And the fix is not correct due to the fact that the remove_connection method is not called on every close method and result is a never-ending loop. Here is a new fix:

- while(!m_connections.empty()) {
- (*m_connections.begin())->close(code,reason);
- }
+	for (std::set::iterator it_con = m_connections.begin(); it_con != m_connections.end();) {
+	const connection_ptr con = *it_con++;
+	con->close(code,reason);
+	}

The logic is that initially the existent iterator is incremented and after may be called the m_connections.erase() method. Before the issue #50 the for circle incremented the iterator after the m_connections.erase() call.