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

Method IsValidSwapTarget

src/DownloadClient.cpp:1543–1575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1541
1542
1543bool CUpDownClient::IsValidSwapTarget( A4AFList::iterator it, bool ignorenoneeded, bool ignoresuspended )
1544{
1545 wxASSERT( it != m_A4AF_list.end() && it->first );
1546
1547 // Check if this file has been suspended
1548 if ( !ignoresuspended ) {
1549 if ( ::GetTickCount64() - it->second.timestamp >= PURGESOURCESWAPSTOP ) {
1550 // The wait-time has been exceeded and the file is now a valid target
1551 it->second.timestamp = 0;
1552 } else {
1553 // The file was still suspended and we are not ignoring suspensions
1554 return false;
1555 }
1556 }
1557
1558 // Check if the client has needed parts
1559 if ( !ignorenoneeded ) {
1560 if ( !it->second.NeededParts ) {
1561 return false;
1562 }
1563 }
1564
1565 // Final checks to see if the client is a valid target
1566 CPartFile* cur_file = it->first;
1567 if ( ( cur_file != m_reqfile && !cur_file->IsStopped() ) &&
1568 ( cur_file->GetStatus() == PS_READY || cur_file->GetStatus() == PS_EMPTY ) &&
1569 ( cur_file->IsPartFile() ) )
1570 {
1571 return true;
1572 } else {
1573 return false;
1574 }
1575}
1576
1577
1578void CUpDownClient::SetRequestFile(CPartFile* reqfile)

Callers

nothing calls this directly

Calls 5

GetTickCount64Function · 0.85
IsStoppedMethod · 0.80
endMethod · 0.45
GetStatusMethod · 0.45
IsPartFileMethod · 0.45

Tested by

no test coverage detected