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

Method GetSlowerDownloadingClient

src/PartFile.cpp:4577–4595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4575#define DROP_FACTOR 2
4576
4577CUpDownClient* 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
4597void CPartFile::AllocationFinished()
4598{

Callers 1

SendBlockRequestsMethod · 0.80

Calls 5

beginMethod · 0.45
endMethod · 0.45
GetClientMethod · 0.45
GetDownloadStateMethod · 0.45
GetKBpsDownMethod · 0.45

Tested by

no test coverage detected