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

Method Process

src/ClientList.cpp:522–724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520
521
522void CClientList::Process()
523{
524 const uint64 cur_tick = ::GetTickCount64();
525
526 if (m_dwLastBannCleanUp + BAN_CLEANUP_TIME < cur_tick) {
527 m_dwLastBannCleanUp = cur_tick;
528
529 ClientMap::iterator it = m_bannedList.begin();
530 while ( it != m_bannedList.end() ) {
531 if ( it->second + CLIENTBANTIME < cur_tick ) {
532 ClientMap::iterator tmp = it++;
533
534 m_bannedList.erase( tmp );
535 theStats::RemoveBannedClient();
536 } else {
537 ++it;
538 }
539 }
540 }
541
542
543 if ( m_dwLastTrackedCleanUp + TRACKED_CLEANUP_TIME < cur_tick ) {
544 m_dwLastTrackedCleanUp = cur_tick;
545
546 std::map<uint32, CDeletedClient*>::iterator it = m_trackedClientsList.begin();
547 while ( it != m_trackedClientsList.end() ) {
548 std::map<uint32, CDeletedClient*>::iterator cur_src = it++;
549
550 if ( cur_src->second->m_dwInserted + KEEPTRACK_TIME < cur_tick ) {
551 delete cur_src->second;
552 m_trackedClientsList.erase( cur_src );
553 }
554 }
555 }
556
557 //We need to try to connect to the clients in m_KadList
558 //If connected, remove them from the list and send a message back to Kad so we can send a ACK.
559 //If we don't connect, we need to remove the client..
560 //The sockets timeout should delete this object.
561
562 // buddy is just a flag that is used to make sure we are still connected or connecting to a buddy.
563 buddyState buddy = Disconnected;
564
565 CClientRefSet::iterator current_it = m_KadSources.begin();
566 while (current_it != m_KadSources.end()) {
567 CUpDownClient* cur_client = current_it->GetClient();
568 ++current_it; // Won't be used anymore till while loop
569 if( !Kademlia::CKademlia::IsRunning() ) {
570 //Clear out this list if we stop running Kad.
571 //Setting the Kad state to KS_NONE causes it to be removed in the switch below.
572 cur_client->SetKadState(KS_NONE);
573 }
574 switch (cur_client->GetKadState()) {
575 case KS_QUEUED_FWCHECK:
576 case KS_QUEUED_FWCHECK_UDP:
577 //Another client asked us to try to connect to them to check their firewalled status.
578 cur_client->TryToConnect(true);
579 break;

Callers

nothing calls this directly

Calls 15

GetTickCount64Function · 0.85
Uint32toStringIPFunction · 0.85
Uint32_16toStringIP_PortFunction · 0.85
eraseMethod · 0.80
SetKadStateMethod · 0.80
TryToConnectMethod · 0.80
GetKadVersionMethod · 0.80
SafeSendPacketMethod · 0.80
SendNullPacketMethod · 0.80
SendBuddyPingPongMethod · 0.80
SendBuddyPingMethod · 0.80
IsLinkedMethod · 0.80

Tested by

no test coverage detected