void CPerfLog::Startup() { if (m_bInitialized) return; // set default log file path TCHAR szAppPath[MAX_PATH]; GetModuleFileName(NULL, szAppPath, MAX_PATH); PathRemoveFileSpec(szAppPath); CString strDefFilePath = szAppPath; strDefFilePath += _T("\\perflog.csv"); CString strIniFile; strIniFile.Format(_T("%spreferences.ini"), thePrefs.GetConfigDir()); CIni ini(strIniFile, _T("PerfLog")); m_eMode = (ELogMode)ini.GetInt(_T("Mode"), None); if (m_eMode != None && m_eMode != OneSample && m_eMode != AllSamples) m_eMode = None; m_dwInterval = MIN2MS(ini.GetInt(_T("Interval"), 5)); if ((int)m_dwInterval <= 0) m_dwInterval = MIN2MS(5); m_strFilePath = ini.GetString(_T("File"), strDefFilePath); if (m_strFilePath.IsEmpty()) m_strFilePath = strDefFilePath; m_bInitialized = true; if (m_eMode == OneSample) LogSamples(); }
void CPerfLog::Startup() { if (m_bInitialized) return; CIni ini(thePrefs.GetConfigFile(), _T("PerfLog")); m_eMode = (ELogMode)ini.GetInt(_T("Mode"), None); if (m_eMode != None && m_eMode != OneSample && m_eMode != AllSamples) m_eMode = None; if (m_eMode != None) { m_eFileFormat = (ELogFileFormat)ini.GetInt(_T("FileFormat"), CSV); // set default log file path CString strDefFilePath = thePrefs.GetMuleDirectory(EMULE_CONFIGBASEDIR); if (m_eFileFormat == CSV) strDefFilePath += _T("perflog.csv"); else strDefFilePath += _T("perflog.mrtg"); m_strFilePath = ini.GetString(_T("File"), strDefFilePath); if (m_strFilePath.IsEmpty()) m_strFilePath = strDefFilePath; if (m_eFileFormat == MRTG) { TCHAR drv[_MAX_DRIVE]; TCHAR dir[_MAX_DIR]; TCHAR nam[_MAX_FNAME]; _tsplitpath(m_strFilePath, drv, dir, nam, NULL); m_strFilePath.Empty(); _tmakepathlimit(m_strMRTGDataFilePath.GetBuffer(MAX_PATH), drv, dir, CString(nam) + _T("_data"), _T("mrtg")); m_strMRTGDataFilePath.ReleaseBuffer(); _tmakepathlimit(m_strMRTGOverheadFilePath.GetBuffer(MAX_PATH), drv, dir, CString(nam) + _T("_overhead"), _T("mrtg")); m_strMRTGOverheadFilePath.ReleaseBuffer(); } m_dwInterval = MIN2MS(ini.GetInt(_T("Interval"), 5)); if ((int)m_dwInterval <= 0) m_dwInterval = MIN2MS(5); } m_bInitialized = true; if (m_eMode == OneSample) LogSamples(); }
void CClientList::AddTrackCallbackRequests(uint32 dwIP){ IPANDTICS add = {dwIP, ::GetTickCount()}; listDirectCallbackRequests.AddHead(add); while (!listDirectCallbackRequests.IsEmpty()){ if (::GetTickCount() - listDirectCallbackRequests.GetTail().dwInserted > MIN2MS(3)) listDirectCallbackRequests.RemoveTail(); else break; } }
CPerfLog::CPerfLog() { m_eMode = None; m_dwInterval = MIN2MS(5); m_bInitialized = false; m_dwLastSampled = 0; m_nLastSessionSentBytes = 0; m_nLastSessionRecvBytes = 0; m_nLastDnOH = 0; m_nLastUpOH = 0; }
void CServerList::Process() { if (::GetTickCount() - m_nLastSaved > MIN2MS(17)) { SaveServermetToFile(); if ( !CGlobalVariable::serverconnect->IsConnecting() && !CGlobalVariable::serverconnect->IsConnected()) { CGlobalVariable::serverconnect->ConnectToAnyServer(); } } }
bool CUpDownClient::ProcessPeerCacheAcknowledge(const uchar* packet, UINT size) { const bool bDebug = (thePrefs.GetDebugClientTCPLevel() > 0); if (bDebug) DebugRecv("OP_PeerCacheAck", this); if (socket == NULL){ ASSERT(0); return false; } m_bPeerCacheUpHit = false; CSafeMemFile data(packet, size); UINT uAck = data.ReadUInt8(); if (uAck == 1) { // Cache hit if (bDebug) Debug(_T(" Cache hit\n")); // PC-TODO: If this socket is closed, PeerCache also closes the socket which it had opened to the // remote client! So, to give the remote client a chance to receive all the data from the PeerCache, // we have to keep this socket open, although it's not needed nor could it be reused! if (m_pPCUpSocket == NULL){ if (thePrefs.GetVerbose()) DebugLogError(_T("PeerCacheAck received - missing socket; %s"), DbgGetClientInfo()); ASSERT(0); return false; } // m_pPCUpSocket->Safe_Delete(); // m_pPCUpSocket = NULL; m_pPCUpSocket->SetTimeOut(MIN2MS(60)); // set socket timeout to 1 hour ?? m_bPeerCacheUpHit = true; } else if (uAck == 0) { // Cache miss, keep uploading if (bDebug) Debug(_T(" Cache miss\n")); } else{ ASSERT(0); return false; } // PC-TODO: Since we can not close the PC socket, what exactly do we need this ACK-packet for? ; UpdateDisplayedInfo(); return true; }
bool CClientList::AllowCalbackRequest(uint32 dwIP) const { for (POSITION pos = listDirectCallbackRequests.GetHeadPosition(); pos != NULL; listDirectCallbackRequests.GetNext(pos)){ if (listDirectCallbackRequests.GetAt(pos).dwIP == dwIP && ::GetTickCount() - listDirectCallbackRequests.GetAt(pos).dwInserted < MIN2MS(3)) return false; } return true; }
void CMuleKad::Process(UINT Tick) { if(m_MyBuddy && IsFirewalled() && m_NextBuddyPing < GetCurTick()) { m_NextBuddyPing = GetCurTick() + MIN2MS(10); m_MyBuddy->SendBuddyPing(); } QVariantMap Request; Request["Firewalled"] = theCore->m_MuleManager->IsFirewalled(CAddress::IPv4, false, true); Request["PublicIP"] = theCore->m_MuleManager->GetAddress(CAddress::IPv4, true).ToQString(); if(theCore->m_MuleManager->IsFirewalled(CAddress::IPv4)) { if(m_MyBuddy) { Request["BuddyIP"] = m_MyBuddy->GetMule().IPv4.ToQString(); Request["BuddyPort"] = m_MyBuddy->GetKadPort(); } } // Note: we always advertize IPv6 addresses CAddress IPv6 = theCore->m_MuleManager->GetAddress(CAddress::IPv6, true); if(!IPv6.IsNull()) Request["IPv6"] = IPv6.ToQString(); if(Tick & EPerSec) { if(theCore->Cfg()->GetBool("Log/Merge")) SyncLog(); } QVariantMap Response = theCore->m_Interfaces->RemoteProcedureCall("MuleKad", "SyncState", Request).toMap(); m_KadID = Response["KadID"].toByteArray(); if(Response["Result"] == "Connected") { if(m_KadStatus != eConnected) { LogLine(LOG_SUCCESS, tr("MuleKad Connected, ID: %1").arg(QString(m_KadID.toHex()).toUpper())); m_KadStatus = eConnected; } } else if(Response["Result"] == "Connecting") m_KadStatus = eConnecting; else //if(Response["Result"] == "Disconnected") m_KadStatus = eDisconnected; if(m_KadStatus == eDisconnected) { if(GetCurTick() > m_NextConnectionAttempt) { LogLine(LOG_INFO, tr("Connecting emule kademlia")); m_NextConnectionAttempt = GetCurTick() + SEC2MS(theCore->Cfg()->GetInt("Ed2kMule/IdleTimeout")); StartKad(); } return; } m_Address = CAddress(Response["PublicIP"].toString()); m_KadPort = Response["KadPort"].toUInt(); // external kad port //m_UDPPort = Response["UDPPort"].toUInt(); // socket port m_Firewalled = Response["Firewalled"].toBool(); m_KadFirewalled = Response["KadFirewalled"].toBool(); if (m_KadFirewalled && m_uNextKadFirewallRecheck <= GetCurTick()) { m_uNextKadFirewallRecheck = GetCurTick() + SEC2MS(theCore->Cfg()->GetInt("Ed2kMule/CheckFWInterval")); CheckFWState(); } foreach(const QVariant& vQueuedFWCheck, Response["QueuedFWChecks"].toList()) { QVariantMap QueuedFWCheck = vQueuedFWCheck.toMap(); SMuleSource Mule; Mule.SetIP(CAddress(QueuedFWCheck["Address"].toString())); Mule.TCPPort = QueuedFWCheck["TCPPort"].toUInt(); Mule.ConOpts.Bits = QueuedFWCheck["ConOpts"].toUInt(); if(Mule.ConOpts.Fields.RequestsCryptLayer) // some cleints seam to mess this up Mule.ConOpts.Fields.SupportsCryptLayer = true; QByteArray UserHash = QueuedFWCheck["UserHash"].toByteArray(); if(!Mule.SelectIP() || !theCore->m_PeerWatch->CheckPeer(Mule.GetIP(), Mule.TCPPort)) continue; bool bAdded = false; CMuleClient* pClient = theCore->m_MuleManager->GetClient(Mule, &bAdded); if(!bAdded) { if(QueuedFWCheck["TestUDP"].toBool() == true) SetUDPFWCheckResult(pClient, true); continue; } if(QueuedFWCheck["TestUDP"].toBool() == true) { uint32 UDPKey; if(QueuedFWCheck.contains("UDPKey")) UDPKey = QueuedFWCheck["UDPKey"].toUInt(); else UDPKey = theCore->m_MuleManager->GetServer()->GetUDPKey(Mule.GetIP()); m_QueuedFWChecks.insert(pClient, SFWCheck(QueuedFWCheck["IntPort"].toUInt(), QueuedFWCheck["ExtPort"].toUInt(), UDPKey)); } else m_QueuedFWChecks.insert(pClient, SFWCheck()); connect(pClient, SIGNAL(HelloRecived()), this, SLOT(OnHelloRecived())); connect(pClient, SIGNAL(SocketClosed()), this, SLOT(OnSocketClosed())); pClient->SetUserHash(UserHash); pClient->Connect(); } QList<CAddress> PendingFWChecks; foreach(const QVariant& vPendingFWCheck, Response["PendingFWChecks"].toList()) { QVariantMap PendingFWCheck = vPendingFWCheck.toMap(); PendingFWChecks.append(CAddress(PendingFWCheck["Address"].toString())); } theCore->m_MuleManager->GetServer()->SetExpected(PendingFWChecks); foreach(const QVariant& vBufferedCallback, Response["BufferedCallbacks"].toList()) { QVariantMap BufferedCallback = vBufferedCallback.toMap(); CAddress Address = CAddress(BufferedCallback["Address"].toString()); uint16 uPort = BufferedCallback["TCPPort"].toUInt(); QByteArray BuddyID = BufferedCallback["BuddyID"].toByteArray(); QByteArray FileID = BufferedCallback["FileID"].toByteArray(); if(m_MyBuddy && m_MyBuddy->IsFirewalled(CAddress::IPv4)) { if(m_MyBuddy->GetBuddyID() == BuddyID) m_MyBuddy->RelayKadCallback(Address, uPort, BuddyID, FileID); } } // Note: This comes in on the normal UDP Socket, as we provide thesocket now we dont haveto pull it /*foreach(const QVariant& vBufferedPackets, Response["BufferedPackets"].toList()) { QVariantMap BufferedPackets = vBufferedPackets.toMap(); CAddress Address = CAddress(BufferedPackets["Address"].toString()); uint16 uPort = BufferedPackets["UDPPort"].toUInt(); QByteArray Data = BufferedPackets["Data"].toByteArray(); CBuffer Packet((byte*)Data.data(), Data.size(), true); RelayUDPPacket(Address, uPort, Packet); } foreach(const QVariant& vPendingCallback, Response["PendingCallbacks"].toList()) { QVariantMap PendingCallback = vPendingCallback.toMap(); SMuleSource Mule; Mule.SetIP(CAddress(PendingCallback["Address"].toString())); Mule.TCPPort = PendingCallback["TCPPort"].toUInt(); Mule.UserHash = PendingCallback["UserHash"].toByteArray(); Mule.ConOpts.Bits = PendingCallback["ConOpts"].toUInt(); if(Mule.ConOpts.Fields.RequestsCryptLayer) // some cleints seam to mess this up Mule.ConOpts.Fields.SupportsCryptLayer = true; theCore->m_MuleManager->CallbackRequested(Mule); }*/ foreach(const QVariant& vPendingBuddys, Response["PendingBuddys"].toList()) { if(m_MyBuddy) // if we have a buddy we are not interested in new ones break; QVariantMap PendingBuddy = vPendingBuddys.toMap(); SMuleSource Mule; Mule.SetIP(CAddress(PendingBuddy["Address"].toString())); Mule.TCPPort = PendingBuddy["TCPPort"].toUInt(); Mule.KadPort = PendingBuddy["KadPort"].toUInt(); Mule.ConOpts.Bits = PendingBuddy["ConOpts"].toUInt(); if(Mule.ConOpts.Fields.RequestsCryptLayer) // some cleints seam to mess this up Mule.ConOpts.Fields.SupportsCryptLayer = true; Mule.UserHash = PendingBuddy["UserHash"].toByteArray(); Mule.BuddyID = PendingBuddy["BuddyID"].toByteArray(); if(!theCore->m_PeerWatch->CheckPeer(Mule.GetIP(), Mule.TCPPort)) continue; bool bAdded = false; CMuleClient* pClient = theCore->m_MuleManager->GetClient(Mule, &bAdded); if(!bAdded) continue; // already known clients are not viable budies connect(pClient, SIGNAL(HelloRecived()), this, SLOT(OnHelloRecived())); connect(pClient, SIGNAL(SocketClosed()), this, SLOT(OnSocketClosed())); if(m_PendingBuddys.contains(pClient)) continue; // already listes m_PendingBuddys.append(pClient); if(PendingBuddy["Incoming"].toBool()) // is this a lowID client that wants us to become his buddy ans will soon connect us? pClient->ExpectConnection(); else //this is a high ID client that agreed to become our buddy pClient->Connect(); } m_KadStats = Response["Stats"].toMap(); if(Tick & EPerSec) { if(IsConnected()) { SyncFiles(); SyncNotes(); foreach(CAbstractSearch* pSearch, m_RunningSearches) SyncSearch(pSearch); } } }
bool kad_session_update( KAD_SESSION* ks, uint32_t now ) { bool result = false; ROUTING_ZONE* rz; LIST* active_zones = NULL; bool zones_locked = false; uint32_t kn_cnt = 0; do { if (ks->timers.self_lookup <= now){ LOG_DEBUG("Self-lookup."); kad_search_find_node(ks, ks->root_zone, &ks->kad_id, &ks->kad_id, true, &ks->searches); ks->timers.self_lookup = now + HR2MS(4); } if (ks->timers.udp_port_lookup <= now && kad_fw_udp_check_running(&ks->fw) && !kad_fw_extrn_port_valid(&ks->fw)){ LOG_DEBUG("Ping packet to random node."); kadhlp_send_ping_pkt_to_rand_node(ks); ks->timers.udp_port_lookup = now + SEC2MS(15); } if (ks->timers.update_user_data <= now){ kad_session_update_user_data(ks); ks->timers.update_user_data = now + SEC2MS(1); } if ( !kad_fw_udp_check_started(&ks->fw) && kad_fw_udp_check_running(&ks->fw) && kad_fw_need_more_udp_checks(&ks->fw) ){ ks->fw.udp_check_running = true; LOG_DEBUG("Starting search for nodes for udp firewall check."); kad_search_find_node_for_fw_check( ks, ks->root_zone, &ks->kad_id, &ks->searches ); } if (kad_fw_extrn_port_valid(&ks->fw) && kad_fw_need_more_udp_checks(&ks->fw)){ LOG_DEBUG("Sending udp firewall check request."); kad_fw_udp_check_request(ks); } ACTIVE_ZONES_LOCK(ks); zones_locked = true; LIST_EACH_ENTRY_WITH_DATA_BEGIN(ks->active_zones, e, rz); if (now >= rz->next_bucket_timer){ kad_zone_update_bucket(ks, rz); rz->next_bucket_timer = now + MIN2MS(1); } if (now >= rz->next_lookup_timer){ LOG_DEBUG("Random lookup."); kad_zone_random_lookup(ks, rz, &ks->kad_id); rz->next_lookup_timer = now + HR2MS(1); } LIST_EACH_ENTRY_WITH_DATA_END(e); // [IMPLEMENT] Empty zones consolidation. if (now >= ks->timers.nodes_count_check){ if (routing_get_nodes_count(ks->root_zone, &kn_cnt, true) && kn_cnt < 200){ // LOG_DEBUG("Bootstrap packet."); // kadhlp_send_bs_req_pkt_to_rand_node(ks); } LOG_DEBUG("Nodes count: %d", kn_cnt); ks->timers.nodes_count_check = now + SEC2MS(10); } ACTIVE_ZONES_UNLOCK(ks); zones_locked = false; // Jumpstart stalled searches. if (now >= ks->timers.search_jumpstart){ // LOG_DEBUG("Jump-start searches."); kad_search_jumpstart_all(ks, &ks->searches); ks->timers.search_jumpstart = now + SEC2MS(1); } } while (false); return result; }
bool kad_session_init( uint16_t tcp_port, uint16_t udp_port, char* nodes_file_path, KAD_SESSION** ks_out ) { bool result = false; KAD_SESSION* ks = NULL; char host_name[HOST_NAME_MAX + 1]; struct hostent* he = NULL; UINT128 zone_idx; uint32_t now = 0; do { LOG_PREFIX("[libkad] "); LOG_LEVEL_DEBUG; LOG_FILE_NAME("libkad.log"); LOG_OUTPUT_CONSOLE_AND_FILE; if (!ks_out) break; ks = (KAD_SESSION*)mem_alloc(sizeof(KAD_SESSION)); if (!ks){ LOG_ERROR("Failed to allocate memory for kad session."); break; } ks->version = KADEMLIA_VERSION; random_init(ticks_now_ms()); gethostname(host_name, HOST_NAME_MAX); LOG_DEBUG("Host name: %s", host_name); he = gethostbyname(host_name); ks->loc_ip4_no = *(uint32_t*)he->h_addr; kad_fw_set_status(&ks->fw, true); kad_fw_set_status_udp(&ks->fw, true); uint128_generate(&ks->kad_id); LOG_DEBUG_UINT128("kad_id: ", ((UINT128*)&ks->kad_id)); for (uint32_t i = 0; i < sizeof(ks->user_hash); i++){ ks->user_hash[i] = random_uint8(); } ks->user_hash[5] = 14; ks->user_hash[14] = 111; kadhlp_gen_udp_key(&ks->udp_key); LOG_DEBUG("udp_key: %.8x", ks->udp_key); ks->udp_port = udp_port; ks->tcp_port = tcp_port; LOG_DEBUG("udp_port = %d", udp_port); LOG_DEBUG("tcp_port = %d", tcp_port); uint128_init(&zone_idx, 0); routing_create_zone(NULL, 0, &zone_idx, &ks->root_zone); list_add_entry(&ks->active_zones, ks->root_zone); now = ticks_now_ms(); ks->timers.self_lookup = now + MIN2MS(3); ks->timers.udp_port_lookup = now; ks->timers.nodes_count_check = now + SEC2MS(10); ks->opts.use_extrn_udp_port = true; queue_create(CONTROL_PACKET_QUEUE_LENGTH, &ks->queue_in_udp); queue_create(CONTROL_PACKET_QUEUE_LENGTH, &ks->queue_out_udp); if (nodes_file_path) kadhlp_add_nodes_from_file(ks, nodes_file_path); kadusr_init(ks); *ks_out = ks; result = true; } while (false); return result; }
void CFriendList::Process() { if (::GetTickCount() - m_nLastSaved > MIN2MS(19)) SaveList(); }
void CFriend::UpdateFriendConnectionState(EFriendConnectReport eEvent) { /*#ifdef _DEBUG CString strDbg; strDbg.Format(_T("*** Debug: UpdateFriendConnectionState, Report: %u, CurrentState: %u \n"), eEvent, m_FriendConnectState); for (POSITION pos = m_liConnectionReport.GetHeadPosition(); pos != 0;) m_liConnectionReport.GetNext(pos)->ReportConnectionProgress(GetLinkedClient(), strDbg, false); #endif*/ if (m_FriendConnectState == FCS_NONE || GetLinkedClient(true) == NULL){ // we aren't currently trying to build up a friendconnection, we shouldn't be called ASSERT( false ); return; } switch (eEvent){ case FCR_ESTABLISHED: case FCR_USERHASHVERIFIED: // connection established, userhash fits, check secureident if (GetLinkedClient()->HasPassedSecureIdent(true)) { // well here we are done, connecting worked out fine m_FriendConnectState = FCS_NONE; for (POSITION pos = m_liConnectionReport.GetHeadPosition(); pos != 0;) m_liConnectionReport.GetNext(pos)->ConnectingResult(GetLinkedClient(), true); m_liConnectionReport.RemoveAll(); FindKadID(); // fetch the kadid of this friend if we don't have it already } else { ASSERT( eEvent != FCR_USERHASHVERIFIED ); // we connected, the userhash matches, now we wait for the authentification // nothing todo, just report about it for (POSITION pos = m_liConnectionReport.GetHeadPosition(); pos != 0; m_liConnectionReport.GetNext(pos)){ m_liConnectionReport.GetAt(pos)->ReportConnectionProgress(GetLinkedClient(), _T(" ...") + GetResString(IDS_TREEOPTIONS_OK) + _T("\n"), true); m_liConnectionReport.GetAt(pos)->ReportConnectionProgress(GetLinkedClient(), _T("*** ") + CString(_T("Authenticating friend")) /*to stringlist*/, false); } if (m_FriendConnectState == FCS_CONNECTING) m_FriendConnectState = FCS_AUTH; else{ // client must have connected to use while we tried something else (like search for him an kad) ASSERT( false ); m_FriendConnectState = FCS_AUTH; } } break; case FCR_DISCONNECTED: // disconnected, lets see which state we were in if (m_FriendConnectState == FCS_CONNECTING || m_FriendConnectState == FCS_AUTH){ if (m_FriendConnectState == FCS_CONNECTING && Kademlia::CKademlia::IsRunning() && Kademlia::CKademlia::IsConnected() && !isnulmd4(m_abyKadID) && (m_dwLastKadSearch == 0 || ::GetTickCount() - m_dwLastKadSearch > MIN2MS(10))) { // connecting failed to the last known IP, now we search kad for an updated IP of our friend m_FriendConnectState = FCS_KADSEARCHING; m_dwLastKadSearch = ::GetTickCount(); for (POSITION pos = m_liConnectionReport.GetHeadPosition(); pos != 0; m_liConnectionReport.GetNext(pos)){ m_liConnectionReport.GetAt(pos)->ReportConnectionProgress(GetLinkedClient(), _T(" ...") + GetResString(IDS_FAILED) + _T("\n"), true); m_liConnectionReport.GetAt(pos)->ReportConnectionProgress(GetLinkedClient(), _T("*** ") + GetResString(IDS_SEARCHINGFRIENDKAD), false); } Kademlia::CKademlia::FindIPByNodeID(*this, m_abyKadID); break; } m_FriendConnectState = FCS_NONE; for (POSITION pos = m_liConnectionReport.GetHeadPosition(); pos != 0;) m_liConnectionReport.GetNext(pos)->ConnectingResult(GetLinkedClient(), false); m_liConnectionReport.RemoveAll(); } else // FCS_KADSEARCHING, shouldn't happen ASSERT( false ); break; case FCR_USERHASHFAILED:{ // the client we connected to, had a different userhash then we expected // drop the linked client object and create a new one, because we don't want to have anything todo // with this instance as it is not our friend which we try to connect to // the connection try counts as failed CUpDownClient* pOld = m_LinkedClient; SetLinkedClient(NULL); // removing old one GetClientForChatSession(); // creating new instance with the hash we search for m_LinkedClient->SetChatState(MS_CONNECTING); for (POSITION pos = m_liConnectionReport.GetHeadPosition(); pos != 0;) // inform others about the change m_liConnectionReport.GetNext(pos)->ClientObjectChanged(pOld, GetLinkedClient()); pOld->SetChatState(MS_NONE); if (m_FriendConnectState == FCS_CONNECTING || m_FriendConnectState == FCS_AUTH){ ASSERT( m_FriendConnectState == FCS_AUTH ); // todo: kad here m_FriendConnectState = FCS_NONE; for (POSITION pos = m_liConnectionReport.GetHeadPosition(); pos != 0;) m_liConnectionReport.GetNext(pos)->ConnectingResult(GetLinkedClient(), false); m_liConnectionReport.RemoveAll(); } else // FCS_KADSEARCHING, shouldn't happen ASSERT( false ); break; } case FCR_SECUREIDENTFAILED: // the client has the fitting userhash, but failed secureident - so we don't want to talk to him // we stop our search here in any case, multiple clientobjects with the same userhash would mess with other things // and its unlikely that we would find him on kad in this case too ASSERT( m_FriendConnectState == FCS_AUTH ); m_FriendConnectState = FCS_NONE; for (POSITION pos = m_liConnectionReport.GetHeadPosition(); pos != 0;) m_liConnectionReport.GetNext(pos)->ConnectingResult(GetLinkedClient(), false); m_liConnectionReport.RemoveAll(); break; case FCR_DELETED: // mh, this should actually never happen i'm sure // todo: in any case, stop any connection tries, notify other etc m_FriendConnectState = FCS_NONE; for (POSITION pos = m_liConnectionReport.GetHeadPosition(); pos != 0;) m_liConnectionReport.GetNext(pos)->ConnectingResult(GetLinkedClient(), false); m_liConnectionReport.RemoveAll(); break; default: ASSERT( false ); } }
void CKnownFileList::Process() { if (::GetTickCount() - m_nLastSaved > MIN2MS(11)) Save(); }
void CFriendList::Process() { if (::GetTickCount() - m_nLastSaved > MIN2MS(19)) SaveList(); }// MORPH START - Added by Commander, Friendlinks [emulEspaña]
void CServerList::Process() { if (::GetTickCount() - m_nLastSaved > MIN2MS(17)) SaveServermetToFile(); }