// TODO: If anyone tries to access this list now...things will be bad... void CMultiSocketServer::CloseAll() { for (ServerSocketIterator it = m_Sockets.begin(); it != m_Sockets.end(); ++it) { CServerSocket* pSocket = it->second; // TODO: Make sure it is Shutdown() first??? pSocket->Close(); delete pSocket; } m_Sockets.clear(); }
// TODO: Synchronize list operations? void CMultiSocketServer::Close(const string& endpoint) { // Find the descriptor in the open socket list CServerSocket* pSocket = FindSocket(endpoint); if (pSocket) { m_Sockets.erase(endpoint); pSocket->Close(); delete pSocket; } }