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

Method ProcessRequestPartsPacketv2

src/UploadClient.cpp:741–775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

739}
740
741void CUpDownClient::ProcessRequestPartsPacketv2(const CMemFile& data) {
742
743 CMD4Hash reqfilehash = data.ReadHash();
744
745 uint8 numblocks = data.ReadUInt8();
746
747 for (int i = 0; i < numblocks; i++) {
748 Requested_Block_Struct* reqblock = new Requested_Block_Struct;
749 try {
750 reqblock->StartOffset = data.GetIntTagValue();
751 // We have to do +1, because the block matching uses that.
752 reqblock->EndOffset = data.GetIntTagValue() + 1;
753 if ((reqblock->StartOffset || reqblock->EndOffset) && (reqblock->StartOffset > reqblock->EndOffset)) {
754 AddDebugLogLineN(logClient, CFormat("Client %s request is invalid! %d / %d")
755 % GetFullIP() % reqblock->StartOffset % reqblock->EndOffset);
756 throw wxString("Client request is invalid!");
757 }
758
759 AddDebugLogLineN(logClient,
760 CFormat("Client %s requests %d File block %d-%d (%d bytes):")
761 % GetFullIP() % i % reqblock->StartOffset % reqblock->EndOffset
762 % (reqblock->EndOffset - reqblock->StartOffset));
763
764 md4cpy(reqblock->FileID, reqfilehash.GetHash());
765 reqblock->transferred = 0;
766 AddReqBlock(reqblock, false);
767 } catch (...) {
768 delete reqblock;
769 throw;
770 }
771 }
772 if (theApp->uploadDiskIOThread) {
773 theApp->uploadDiskIOThread->NewBlockRequestsAvailable();
774 }
775}
776// File_checked_for_headers

Callers 1

ProcessED2Kv2PacketMethod · 0.80

Calls 8

CFormatClass · 0.85
md4cpyFunction · 0.85
ReadUInt8Method · 0.80
wxStringClass · 0.70
ReadHashMethod · 0.45
GetIntTagValueMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected