| 4575 | #define DROP_FACTOR 2 |
| 4576 | |
| 4577 | CUpDownClient* CPartFile::GetSlowerDownloadingClient(uint32 speed, CUpDownClient* caller) { |
| 4578 | // printf("Start slower source calculation\n"); |
| 4579 | for( SourceSet::iterator it = m_SrcList.begin(); it != m_SrcList.end(); ) { |
| 4580 | CUpDownClient* cur_src = it++->GetClient(); |
| 4581 | if ((cur_src->GetDownloadState() == DS_DOWNLOADING) && (cur_src != caller)) { |
| 4582 | uint32 factored_bytes_per_second = static_cast<uint32>( |
| 4583 | (cur_src->GetKBpsDown() * 1024) * DROP_FACTOR); |
| 4584 | if ( factored_bytes_per_second< speed) { |
| 4585 | // printf("Selecting source %p to drop: %d < %d\n", cur_src, factored_bytes_per_second, speed); |
| 4586 | // printf("End slower source calculation\n"); |
| 4587 | return cur_src; |
| 4588 | } else { |
| 4589 | // printf("Not selecting source %p to drop: %d > %d\n", cur_src, factored_bytes_per_second, speed); |
| 4590 | } |
| 4591 | } |
| 4592 | } |
| 4593 | // printf("End slower source calculation\n"); |
| 4594 | return NULL; |
| 4595 | } |
| 4596 | |
| 4597 | void CPartFile::AllocationFinished() |
| 4598 | { |
no test coverage detected