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

Method ProcessFileStatus

src/DownloadClient.cpp:386–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386void CUpDownClient::ProcessFileStatus(bool bUdpPacket, const CMemFile* data, const CPartFile* file)
387{
388 // 0.42e
389 wxString strReqFileNull("ERROR: Wrong file ID (ProcessFileStatus; m_reqfile==NULL)");
390
391 if ( !m_reqfile || file != m_reqfile ){
392 if (!m_reqfile) {
393 throw strReqFileNull;
394 }
395 throw wxString("ERROR: Wrong file ID (ProcessFileStatus; m_reqfile!=file)");
396 }
397
398 uint16 nED2KPartCount = data->ReadUInt16();
399
400 m_reqfile->UpdatePartsFrequency( this, false ); // Decrement
401 m_downPartStatus.clear();
402
403 bool bPartsNeeded = false;
404 if (!nED2KPartCount)
405 {
406 m_nPartCount = m_reqfile->GetPartCount();
407 m_downPartStatus.setsize( m_nPartCount, 1);
408 bPartsNeeded = true;
409 m_bCompleteSource = true;
410 }
411 else
412 {
413 // Somehow this happened.
414 if (!m_reqfile) {
415 throw strReqFileNull;
416 }
417 if (m_reqfile->GetED2KPartCount() != nED2KPartCount)
418 {
419 wxString strError;
420 strError << "ProcessFileStatus - wrong part number recv=" << nED2KPartCount <<
421 " expected=" << m_reqfile->GetED2KPartCount() << " " <<
422 m_reqfile->GetFileHash().Encode();
423 m_nPartCount = 0;
424 throw strError;
425 }
426 m_nPartCount = m_reqfile->GetPartCount();
427
428 m_bCompleteSource = false;
429 m_downPartStatus.setsize( m_nPartCount, 0 );
430 uint16 done = 0;
431
432 try {
433 while (done != m_nPartCount) {
434 uint8 toread = data->ReadUInt8();
435
436 for ( uint8 i = 0;i < 8; i++ ) {
437 bool status = ((toread>>i)&1)? 1:0;
438 m_downPartStatus.set(done, status);
439
440 if (status) {
441 if (!m_reqfile->IsComplete(done)){
442 bPartsNeeded = true;
443 }

Callers 3

ProcessPacketMethod · 0.80
ProcessExtPacketMethod · 0.80
ProcessPacketMethod · 0.80

Calls 15

ReadUInt16Method · 0.80
UpdatePartsFrequencyMethod · 0.80
GetPartCountMethod · 0.80
setsizeMethod · 0.80
GetED2KPartCountMethod · 0.80
ReadUInt8Method · 0.80
setMethod · 0.80
IsHashSetNeededMethod · 0.80
Copy16ToDataBufferMethod · 0.80
GetPacketSizeMethod · 0.80
SetHashSetNeededMethod · 0.80
wxStringClass · 0.70

Tested by

no test coverage detected