void CListenSocket::OnAccept(int nErrorCode) { // 0.42e if (!nErrorCode) { m_nPendingConnections++; if (m_nPendingConnections < 1) { wxFAIL; m_nPendingConnections = 1; } if (TooManySockets(true) && !theApp->serverconnect->IsConnecting()) { StopListening(); return; } else if (bListening == false) { // If the client is still at maxconnections, // this will allow it to go above it ... // But if you don't, you will get a lowID on all servers. ReStartListening(); } // Deal with the pending connections, there might be more than one, due to // the StopListening() call above. while (m_nPendingConnections) { m_nPendingConnections--; // Create a new socket to deal with the connection CClientTCPSocket* newclient = new CClientTCPSocket(); // Accept the connection and give it to the newly created socket if (!AcceptWith(*newclient, false)) { newclient->Safe_Delete(); } else { wxASSERT(theApp->IsRunning()); if (!newclient->InitNetworkData()) { // IP or port were not returned correctly // from the accepted address, or filtered. newclient->Safe_Delete(); } } } } }