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

Method NotifyPathAdded

src/SharedFileList.cpp:668–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

666// shareset blocks the GUI for minutes per event. See issue #745.
667
668void CSharedFileList::NotifyPathAdded(const wxString& fullPath)
669{
670 if (fullPath.IsEmpty()) {
671 return;
672 }
673
674 // Already shared? CPartFile::CompleteFile() and SafeAddKFile() are
675 // the canonical add paths for completed downloads — by the time
676 // the watcher's CREATE event fires for a freshly-renamed file in
677 // Incoming, the CKnownFile is usually already in m_Files_map and
678 // the path index. Nothing to do in that case. Scoped lock so we
679 // drop list_mut before doing any filesystem work.
680 {
681 wxMutexLocker existsCheck(list_mut);
682 if (m_pathIndex.find(fullPath) != m_pathIndex.end()) {
683 return;
684 }
685 }
686
687 CPath full(fullPath);
688 if (!full.IsOk()) {
689 return;
690 }
691 const CPath directory = full.GetPath();
692 const CPath fname = CPath(full.GetFullName());
693 if (!directory.IsOk() || !fname.IsOk()) {
694 return;
695 }
696
697 TaskList hashTasks;
698 switch (AddPathToShares(directory, fname, hashTasks)) {
699 case kAddPathQueued:
700 // Hand the new hashing task to the scheduler. The thread
701 // will call SafeAddKFile() when it finishes, which is
702 // what publishes the file to peers + the GUI.
703 for (TaskList::iterator it = hashTasks.begin(); it != hashTasks.end(); ++it) {
704 CThreadScheduler::AddTask(*it);
705 }
706 break;
707 case kAddPathKnown:
708 case kAddPathSkipped:
709 // AddPathToShares already wrote a debug log line; no
710 // further action needed.
711 break;
712 }
713}
714
715
716void CSharedFileList::NotifyPathRemoved(const wxString& fullPath)

Callers 1

FlushPendingEventsMethod · 0.80

Calls 7

GetPathMethod · 0.80
GetFullNameMethod · 0.80
CPathClass · 0.70
IsEmptyMethod · 0.45
endMethod · 0.45
IsOkMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected