DWORD CDownloadWithSources::GetED2KCompleteSourceCount() const { CQuickLock pLock( Transfers.m_pSection ); const DWORD tNow = GetTickCount(); DWORD nCount = 0; for ( POSITION posSource = GetIterator() ; posSource ; ) { CDownloadSource* pSource = GetNext( posSource ); if ( ( ! pSource->m_bPushOnly ) && // Push sources shouldn't be counted since you often cannot reach them ( pSource->m_tAttempt < tNow || pSource->m_tAttempt - tNow <= 900000 ) && // Only count sources that are probably active ( pSource->m_nProtocol == PROTOCOL_ED2K ) && // Only count ed2k sources ( pSource->m_oAvailable.empty() && pSource->IsOnline() ) ) // Only count complete sources { nCount++; } } return nCount; }