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

Method AddFile

src/SharedFileList.cpp:565–590  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563
564
565bool CSharedFileList::AddFile(CKnownFile* pFile)
566{
567 wxASSERT(pFile->GetHashCount() == pFile->GetED2KPartHashCount());
568
569 wxMutexLocker lock(list_mut);
570
571 CKnownFileMap::value_type entry(pFile->GetFileHash(), pFile);
572 if (m_Files_map.insert(entry).second) {
573 /* Keywords to publish on Kad */
574 m_keywords->AddKeywords(pFile);
575 theStats::AddSharedFile(pFile->GetFileSize());
576 // Mirror into the path index so the watcher's per-event
577 // dispatch can resolve DELETE / MODIFY events to the
578 // CKnownFile* in O(1). Empty key (e.g. a CPartFile whose
579 // SetFilePath has not run yet) is harmless: it lives in
580 // m_pathIndex under "" until SafeAddKFile attaches the real
581 // path via the post-completion path. Stale entries left
582 // over from a previous shared-list membership are
583 // overwritten here.
584 const wxString key =
585 pFile->GetFilePath().JoinPaths(pFile->GetFileName()).GetRaw();
586 m_pathIndex[key] = pFile;
587 return true;
588 }
589 return false;
590}
591
592
593void CSharedFileList::SafeAddKFile(CKnownFile* toadd, bool bOnlyAdd)

Callers 2

ProcessUpdateMethod · 0.45
DownloadCtrlAddFileFunction · 0.45

Calls 7

GetHashCountMethod · 0.80
GetED2KPartHashCountMethod · 0.80
insertMethod · 0.80
AddKeywordsMethod · 0.80
GetRawMethod · 0.80
JoinPathsMethod · 0.80
GetFileSizeMethod · 0.45

Tested by

no test coverage detected