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

Method ConnectToServer

src/ServerSocket.cpp:579–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577}
578
579void CServerSocket::ConnectToServer(CServer* server, bool bNoCrypt)
580{
581 AddDebugLogLineN(logServer, "Trying to connect");
582
583 if (cur_server){
584 wxFAIL;
585 delete cur_server;
586 cur_server = NULL;
587 }
588
589 cur_server = new CServer(server);
590
591 m_bNoCrypt = bNoCrypt;
592
593 SetConnectionState(CS_CONNECTING);
594
595 info = cur_server->GetListName();
596
597 // This must be used if we want to reverse-check the addr of the server
598 if (cur_server->HasDynIP() || !cur_server->GetIP()) {
599 m_IsSolving = true;
600 // Send it to solving thread.
601 CAsyncDNS* dns = new CAsyncDNS(server->GetAddress(), DNS_SERVER_CONNECT, theApp, this);
602
603 if ( dns->Create() == wxTHREAD_NO_ERROR ) {
604 if ( dns->Run() != wxTHREAD_NO_ERROR ) {
605 dns->Delete();
606 AddLogLineN(CFormat( _("Cannot create DNS solving thread for connecting to %s") ) % cur_server->GetAddress());
607 }
608 } else {
609 dns->Delete();
610 AddLogLineN(CFormat( _("Cannot create DNS solving thread for connecting to %s") ) % cur_server->GetAddress());
611 }
612 } else {
613 // Nothing to solve, we already have the IP
614 OnHostnameResolved(cur_server->GetIP());
615 }
616
617}
618
619void CServerSocket::OnError(int DEBUG_ONLY(nErrorCode))
620{

Callers 2

OnConnectToServerMethod · 0.45
Get_EC_Response_ServerFunction · 0.45

Calls 5

CFormatClass · 0.85
HasDynIPMethod · 0.80
RunMethod · 0.80
GetIPMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected