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

Method SendSharedFilesOfDirectory

src/BaseClient.cpp:2860–2899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2858}
2859
2860void CUpDownClient::SendSharedFilesOfDirectory(const wxString& strReqDir)
2861{
2862 CKnownFilePtrList list;
2863
2864 if (strReqDir == OP_INCOMPLETE_SHARED_FILES) {
2865 // get all shared files from download queue
2866 int iQueuedFiles = theApp->downloadqueue->GetFileCount();
2867 for (int i = 0; i < iQueuedFiles; i++) {
2868 CPartFile* pFile = theApp->downloadqueue->GetFileByIndex(i);
2869 if (pFile == NULL || pFile->GetStatus(true) != PS_READY) {
2870 continue;
2871 }
2872 list.push_back(pFile);
2873 }
2874 } else {
2875 // get all shared files for the requested directory
2876 const CPath *sharedDir = theApp->sharedfiles->GetDirForPublicSharedDirName(strReqDir);
2877 if (sharedDir) {
2878 theApp->sharedfiles->GetSharedFilesByDirectory(sharedDir->GetRaw(), list);
2879 } else {
2880 AddLogLineC(CFormat(_("User %s (%u) requested sharedfiles-list for not existing directory '%s' -> Ignored")) % GetUserName() % GetUserIDHybrid() % strReqDir);
2881 }
2882 }
2883
2884 CMemFile tempfile(80);
2885 tempfile.WriteString(strReqDir, GetUnicodeSupport());
2886 tempfile.WriteUInt32(list.size());
2887
2888 while (!list.empty()) {
2889 if (!list.front()->IsLargeFile() || SupportsLargeFiles()) {
2890 list.front()->CreateOfferedFilePacket(&tempfile, NULL, this);
2891 }
2892 list.pop_front();
2893 }
2894
2895 CPacket* replypacket = new CPacket(tempfile, OP_EDONKEYPROT, OP_ASKSHAREDFILESDIRANS);
2896 theStats::AddUpOverheadOther(replypacket->GetPacketSize());
2897 AddDebugLogLineN( logLocalClient, "Local Client: OP_ASKSHAREDFILESDIRANS to " + GetFullIP() );
2898 SendPacket(replypacket, true, true);
2899}
2900
2901void CUpDownClient::SendFirewallCheckUDPRequest()
2902{

Callers 1

ProcessPacketMethod · 0.80

Calls 14

CFormatClass · 0.85
GetRawMethod · 0.80
WriteStringMethod · 0.80
WriteUInt32Method · 0.80
IsLargeFileMethod · 0.80
GetPacketSizeMethod · 0.80
GetFileCountMethod · 0.45
GetFileByIndexMethod · 0.45
GetStatusMethod · 0.45

Tested by

no test coverage detected