@@ -242,7 +242,7 @@ unsigned int ProcessExecutor::check()
242242
243243 std::list<int > rpipes;
244244 std::map<pid_t , std::string> childFile;
245- std::map<int , std::string> pipeFile;
245+ std::map<int , std::pair<std:: string, std:: size_t > > pipeFile;
246246 std::size_t processedsize = 0 ;
247247 std::list<FileWithDetails>::const_iterator iFile = mFiles .cbegin ();
248248 std::list<FileSettings>::const_iterator iFileSettings = mFileSettings .cbegin ();
@@ -301,11 +301,11 @@ unsigned int ProcessExecutor::check()
301301 rpipes.push_back (pipes[0 ]);
302302 if (iFileSettings != mFileSettings .end ()) {
303303 childFile[pid] = iFileSettings->filename () + ' ' + iFileSettings->cfg ;
304- pipeFile[pipes[0 ]] = iFileSettings->filename () + ' ' + iFileSettings->cfg ;
304+ pipeFile[pipes[0 ]] = { iFileSettings->filename () + ' ' + iFileSettings->cfg , iFileSettings-> filesize () } ;
305305 ++iFileSettings;
306306 } else {
307307 childFile[pid] = iFile->path ();
308- pipeFile[pipes[0 ]] = iFile->path ();
308+ pipeFile[pipes[0 ]] = { iFile->path (), iFile-> size () } ;
309309 ++iFile;
310310 }
311311 }
@@ -324,28 +324,16 @@ unsigned int ProcessExecutor::check()
324324 while (rp != rpipes.cend ()) {
325325 if (FD_ISSET (*rp, &rfds)) {
326326 std::string name;
327- const std::map<int , std::string>::const_iterator p = pipeFile.find (*rp);
327+ std::size_t size = 0 ;
328+ const std::map<int , std::pair<std::string, std::size_t >>::const_iterator p = pipeFile.find (*rp);
328329 if (p != pipeFile.cend ()) {
329- name = p->second ;
330+ name = p->second .first ;
331+ size = p->second .second ;
330332 }
331333 const bool readRes = handleRead (*rp, result, name);
332334 if (!readRes) {
333- std::size_t size = 0 ;
334335 if (p != pipeFile.cend ()) {
335336 pipeFile.erase (p);
336- const auto fs = std::find_if (mFileSettings .cbegin (), mFileSettings .cend (), [&name](const FileSettings& entry) {
337- return name.find (entry.filename () + " " ) == 0 ;
338- });
339- if (fs == mFileSettings .cend ()) {
340- const auto fwd = std::find_if (mFiles .cbegin (), mFiles .cend (), [&name](const FileWithDetails &entry) {
341- return name.find (entry.path () + " " ) == 0 ;
342- });
343- if (fwd != mFiles .cend ()) {
344- size = fwd->size ();
345- }
346- } else {
347- size = fs->filesize ();
348- }
349337 }
350338
351339 fileCount++;
0 commit comments