void CSocketManager::DoPulse() { // Loop through all sockets processQueue = deque <CSocket*>(vecSockets.begin(), vecSockets.end()); while (!processQueue.empty()) { CSocket* pSocket = processQueue.front(); processQueue.pop_front(); // Do a pulse at the socket if (!pSocket->DoPulse()) { // If the pulse indicates failure, remove the socket SocketRemove(pSocket); } } // Finally cleanup sockets that were removed while (!deleteList.empty()) { CSocket* pSocket = deleteList.front(); deleteList.pop_front(); SAFE_DELETE(pSocket); } }