MCPcopy Create free account
hub / github.com/amule-project/amule / IsServerIP

Method IsServerIP

src/ServerConnect.cpp:586–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584
585
586bool CServerConnect::IsServerIP(uint32 ip) const
587{
588 if (ip == 0) {
589 return false;
590 }
591 // Match the live connection first -- cheapest, hottest case.
592 if (connectedsocket && connectedsocket->cur_server
593 && connectedsocket->cur_server->GetIP() == ip) {
594 return true;
595 }
596 // Then any login still in flight. m_lstOpenSockets includes
597 // connectedsocket too, but the early-out above keeps the common
598 // case to a single pointer chase; the loop only runs when we're
599 // actively trying multiple servers in parallel, which is bounded
600 // by max_simcons (typically 2-3) so it's negligible.
601 for (SocketsList::const_iterator it = m_lstOpenSockets.begin();
602 it != m_lstOpenSockets.end(); ++it) {
603 const CServerSocket* sock = *it;
604 if (sock && sock->cur_server && sock->cur_server->GetIP() == ip) {
605 return true;
606 }
607 }
608 return false;
609}
610
611
612void CServerConnect::KeepConnectionAlive()

Callers 1

IsDownloadThrottledMethod · 0.80

Calls 3

GetIPMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected