From 8dc9b101b1200dfeba8a7d8e28eb6246df78b10f Mon Sep 17 00:00:00 2001 From: Markus Date: Sat, 26 Mar 2022 13:42:15 +0100 Subject: [PATCH] fix clean methode && cookie file in multi thread -> for each one ,one --- src/parameterManager.cpp | 14 +++++++------- src/parameterManager.h | 2 +- src/programManager.cpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/parameterManager.cpp b/src/parameterManager.cpp index 066401d..3256805 100644 --- a/src/parameterManager.cpp +++ b/src/parameterManager.cpp @@ -1220,18 +1220,18 @@ void unterOption_clean(Settings * settings, int argc, char **argv) } } //UM sachen nach multipage update zu löschen - for ( const auto &p : settings->pagesInUse ) { - if(fileExists(settings->cookieFilePath + "_" + p.name_id)) { - if(remove((settings->cookieFilePath + "_" + p.name_id).c_str()) != 0) { - perror(( " => Error: Das löschen von " + settings->cookieFilePath + "_" + p.name_id + " ist fehlgeschlagen: ").c_str()); + for ( const auto &p : settings->pagesALL ) { + if(fileExists(settings->cookieFilePath + "_" + p.url)) { + if(remove((settings->cookieFilePath + "_" + p.url).c_str()) != 0) { + perror(( " => Error: Das löschen von " + settings->cookieFilePath + "_" + p.url + " ist fehlgeschlagen: ").c_str()); return; } else ++count; } - for (unsigned i = 0; i < UINT_MAX && fileExists(settings->cookieFilePath + "_" + p.name_id + std::to_string(i)); ++i) { - if(remove( (settings->cookieFilePath + "_" + p.name_id + std::to_string(i)).c_str() ) != 0) { - perror((" => Error: Das löschen von " + settings->cookieFilePath + "_" + p.name_id + std::to_string(i) + " ist fehlgeschlagen: ").c_str()); + for (unsigned i = 0; i < UINT_MAX && fileExists(settings->cookieFilePath + "_" + p.url + std::to_string(i)); ++i) { + if(remove( (settings->cookieFilePath + "_" + p.url + std::to_string(i)).c_str() ) != 0) { + perror((" => Error: Das löschen von " + settings->cookieFilePath + "_" + p.url + std::to_string(i) + " ist fehlgeschlagen: ").c_str()); return; } else { ++count; diff --git a/src/parameterManager.h b/src/parameterManager.h index 75ad9b3..45ddfe6 100644 --- a/src/parameterManager.h +++ b/src/parameterManager.h @@ -28,7 +28,7 @@ #define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files=" #define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files=" -#define VERSION "5.2.0" +#define VERSION "5.2.1" #define DEFAULT_FILE_VERSION "2.3" //default, anime, normal, diff --git a/src/programManager.cpp b/src/programManager.cpp index 6977046..290ecab 100644 --- a/src/programManager.cpp +++ b/src/programManager.cpp @@ -117,7 +117,7 @@ void * threadFunction(void * data) { } for (int i = 1; i <= 3; ++i) { - auto REPLy = myThreadData->pageManager->getUrlAfterRedirect( myThreadData->page.protocol, myThreadData->page.url + Link, myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url); + auto REPLy = myThreadData->pageManager->getUrlAfterRedirect( myThreadData->page.protocol, myThreadData->page.url + Link, myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url + std::to_string(myThreadData->id)); std::string newUrl = REPLy.url; if (newUrl == "-1") { if(myThreadData->settings->debugMode) @@ -133,7 +133,7 @@ void * threadFunction(void * data) { } else if(newUrl.find("/redirect/") != std::string::npos ) { if(myThreadData->settings->debugMode) std::cout << " > Thread " << myThreadData->id << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl; - if(myThreadData->pageManager->login(myThreadData->page, myThreadData->accountManager->getNextAccount(), myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url) != 0) { + if(myThreadData->pageManager->login(myThreadData->page, myThreadData->accountManager->getNextAccount(), myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url + std::to_string(myThreadData->id)) != 0) { if(myThreadData->settings->debugMode) std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": login Function failed." << std::endl; return myThreadData->setState(17);