Example #1
0
void CEDClients::OnRun()
{
	DWORD tNow = GetTickCount();

	// Delay to limit the rate of ed2k packets being sent.
	// Keep ed2k transfers under 10 KB/s per source
	if ( tNow < m_tLastRun + Settings.eDonkey.PacketThrottle )
		return;

	CSingleLock oCEDClientsLock( &m_pSection );
	if ( ! oCEDClientsLock.Lock( 250 ) )
		return;

	CSingleLock oCTransfersLock( &Transfers.m_pSection );
	if ( ! oCTransfersLock.Lock( 250 ) )
		return;

	tNow = GetTickCount();	// Update

	if ( Settings.eDonkey.ServerWalk &&
		 Network.IsConnected() &&
		 Settings.eDonkey.Enabled )
		RunGlobalStatsRequests( tNow );

	for ( CEDClient* pClient = m_pFirst ; pClient ; )
	{
		CEDClient* pNext = pClient->m_pEdNext;
		pClient->OnRunEx( tNow );
		pClient = pNext;
	}

	m_tLastRun = tNow;
}
Example #2
0
void CEDClients::OnRun()
{

	// Delay to limit the rate of ed2k packets being sent.
	// keep ed2k transfers under 10 KB/s per source
	DWORD tNow = GetTickCount();
	if ( tNow - m_tLastRun < Settings.eDonkey.PacketThrottle ) return;
	m_tLastRun = tNow;

	if ( Settings.eDonkey.ServerWalk && Settings.eDonkey.EnableToday )
	{
		RunGlobalStatsRequests( tNow );
	}
	
	for ( CEDClient* pClient = m_pFirst ; pClient ; )
	{
		CEDClient* pNext = pClient->m_pEdNext;
		pClient->OnRunEx( tNow );
		pClient = pNext;
	}
}