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

Method PartFileHashFinished

src/PartFile.cpp:1243–1340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1241}
1242
1243void CPartFile::PartFileHashFinished(CKnownFile* result)
1244{
1245 m_lastDateChanged = result->m_lastDateChanged;
1246 bool errorfound = false;
1247 if (GetED2KPartHashCount() == 0){
1248 if (IsComplete(0, GetFileSize()-1)){
1249 if (result->GetFileHash() != GetFileHash()){
1250 // cppcheck-suppress zerodiv
1251 AddLogLineN(CFormat(wxPLURAL(
1252 "Found corrupted part (%d) in %d part file %s - FileResultHash |%s| FileHash |%s|",
1253 "Found corrupted part (%d) in %d parts file %s - FileResultHash |%s| FileHash |%s|",
1254 0)
1255 )
1256 % 1
1257 % 0
1258 % GetFileName()
1259 % result->GetFileHash().Encode()
1260 % GetFileHash().Encode() );
1261 AddGap(0, GetFileSize()-1);
1262 errorfound = true;
1263 }
1264 }
1265 }
1266 else{
1267 for (size_t i = 0; i < m_hashlist.size(); ++i){
1268 // Kry - trel_ar's completed parts check on rehashing.
1269 // Very nice feature, if a file is completed but .part.met don't believe it,
1270 // update it.
1271
1272 if (!( i < result->GetHashCount() && (result->GetPartHash(i) == GetPartHash(i)))){
1273 if (IsComplete(i)) {
1274 CMD4Hash wronghash;
1275 if ( i < result->GetHashCount() )
1276 wronghash = result->GetPartHash(i);
1277
1278 AddLogLineN(CFormat(wxPLURAL(
1279 "Found corrupted part (%d) in %d part file %s - FileResultHash |%s| FileHash |%s|",
1280 "Found corrupted part (%d) in %d parts file %s - FileResultHash |%s| FileHash |%s|",
1281 GetED2KPartHashCount())
1282 )
1283 % ( i + 1 )
1284 % GetED2KPartHashCount()
1285 % GetFileName()
1286 % wronghash.Encode()
1287 % GetPartHash(i).Encode() );
1288
1289 AddGap(i);
1290 errorfound = true;
1291 }
1292 } else {
1293 if (!IsComplete(i)){
1294 AddLogLineN(CFormat( _("Found completed part (%i) in %s") )
1295 % ( i + 1 )
1296 % GetFileName() );
1297
1298 FillGap(i);
1299 uint64 partStart = i * PARTSIZE;
1300 uint64 partEnd = partStart + GetPartSize(i) - 1;

Callers 1

OnFinishedHashingMethod · 0.80

Calls 9

CFormatClass · 0.85
GetHashCountMethod · 0.80
GetAICHHashsetMethod · 0.80
SetAICHHashsetMethod · 0.80
SetOwnerMethod · 0.80
EncodeMethod · 0.45
sizeMethod · 0.45
GetStatusMethod · 0.45
SafeAddKFileMethod · 0.45

Tested by

no test coverage detected