forked from markus/S_New4
add ThreadLimit
This commit is contained in:
parent
955d422b60
commit
19130ac359
2
main.cpp
2
main.cpp
@ -1,6 +1,4 @@
|
||||
#include "programManager.h"
|
||||
#include "parameterManager.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -201,8 +201,11 @@ int loadDefaulOptions(Settings &settings)
|
||||
} else if (what == "default-maxThreads") {
|
||||
settings.maxThreads = static_cast<unsigned>(atoi(data.c_str()));
|
||||
if(std::to_string(settings.maxThreads) != data ) {
|
||||
std::cout << " => Error_Defaults: Ungültige Zahl: " << data << std::endl;
|
||||
std::cout << " => Error_Defaults: Thread-Max Ungültige Zahl: " << data << std::endl;
|
||||
return 18;
|
||||
} else if (settings.maxThreads > 10) {
|
||||
std::cout << " => Error_Defaults: Thread-Max: Zahl größer 10: " << data << std::endl;
|
||||
return 19;
|
||||
}
|
||||
if(settings.debugMode)
|
||||
std::cout << " > Defaults: MaxThreads: " << settings.maxThreads << std::endl;
|
||||
@ -320,10 +323,10 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
|
||||
std::string portStr = optarg.substr(optarg.find(":") + 1, optarg.length() - optarg.find(":"));
|
||||
int port = atoi(portStr.c_str());
|
||||
if(std::to_string(port) != portStr || port <= 0) {
|
||||
std::cout << "[-p]: Invalid Port: " << portStr << std::endl;
|
||||
std::cout << " => Error: [-p]: Invalid Port: " << portStr << std::endl;
|
||||
return 32;
|
||||
} else if (ip == "") {
|
||||
std::cout << "[-p]: Invalid Ip Addresse: " << ip << std::endl;
|
||||
std::cout << " => Error: [-p]: Invalid Ip Addresse: " << ip << std::endl;
|
||||
return 34;
|
||||
} else if(settings->debugMode) {
|
||||
std::cout << "Proxy Addresse: "<< ip << ":" << port << std::endl;
|
||||
@ -409,7 +412,7 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
|
||||
break;
|
||||
settings->default_maxDirs = atoi(optarg);
|
||||
if(std::to_string(settings->default_maxDirs) != std::string(optarg) ) {
|
||||
std::cout << "[-D]: Invalid Count: " << optarg << std::endl;
|
||||
std::cout << " => Error: [-D]: Invalid Count: " << optarg << std::endl;
|
||||
return 18;
|
||||
}
|
||||
if(settings->debugMode)
|
||||
@ -421,8 +424,11 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
|
||||
break;
|
||||
settings->maxThreads = static_cast<unsigned>(atoi(optarg));
|
||||
if(std::to_string(settings->maxThreads) != std::string(optarg) ) {
|
||||
std::cout << "[-t]: Ungültige Zahl: " << optarg << std::endl;
|
||||
std::cout << " => Error: [-t]: Thread-Max: Ungültige Zahl: " << optarg << std::endl;
|
||||
return 18;
|
||||
} else if (settings->maxThreads > 10 && !settings->debugMode) {
|
||||
std::cout << " => Error: [-t]: Thread-Max: Zahl ist größer 10: " << optarg << std::endl;
|
||||
return 19;
|
||||
}
|
||||
if(settings->debugMode)
|
||||
std::cout << "MaxThreads: " << settings->maxThreads << std::endl;
|
||||
@ -576,7 +582,7 @@ void unterOption_default_help()
|
||||
<< " Thread, bis die angegebene Anzahl an Threads erreicht" << std::endl
|
||||
<< " wurde. Dannm wartet es auf das Enden der Threads und" << std::endl
|
||||
<< " beginnt von vorne. Verwende 0 um das Multihreading zu" << std::endl
|
||||
<< " deaktivieren." << std::endl
|
||||
<< " deaktivieren. Maximal 10 Threads." << std::endl
|
||||
<< " Standart: 0" << std::endl << std::endl
|
||||
<< "HELPMENUE:" << std::endl
|
||||
<< " -h, --help" << std::endl
|
||||
@ -615,10 +621,10 @@ int unterOption_url(Settings *settings, int argc, char **argv)
|
||||
std::string portStr = optarg.substr(optarg.find(":") + 1, optarg.length() - optarg.find(":"));
|
||||
int port = atoi(portStr.c_str());
|
||||
if(std::to_string(port) != portStr || port <= 0) {
|
||||
std::cout << "[-p]: Invalid Port: " << portStr << std::endl;
|
||||
std::cout << " => Error: [-p]: Invalid Port: " << portStr << std::endl;
|
||||
return 32;
|
||||
} else if (ip == "") {
|
||||
std::cout << "[-p]: Invalid Ip Addresse: " << ip << std::endl;
|
||||
std::cout << " => Error: [-p]: Invalid Ip Addresse: " << ip << std::endl;
|
||||
return 34;
|
||||
} else if(settings->debugMode) {
|
||||
std::cout << "Proxy Addresse: "<< ip << ":" << port << std::endl;
|
||||
@ -732,10 +738,10 @@ int unterOption_search(Settings *settings, int argc, char **argv)
|
||||
std::string portStr = optarg.substr(optarg.find(":") + 1, optarg.length() - optarg.find(":"));
|
||||
int port = atoi(portStr.c_str());
|
||||
if(std::to_string(port) != portStr || port <= 0) {
|
||||
std::cout << "[-p]: Invalid Port: " << portStr << std::endl;
|
||||
std::cout << " => Error: [-p]: Invalid Port: " << portStr << std::endl;
|
||||
return 32;
|
||||
} else if (ip == "") {
|
||||
std::cout << "[-p]: Invalid Ip Addresse: " << ip << std::endl;
|
||||
std::cout << " => Error: [-p]: Invalid Ip Addresse: " << ip << std::endl;
|
||||
return 34;
|
||||
} else if(settings->debugMode) {
|
||||
std::cout << "Proxy Addresse: "<< ip << ":" << port << std::endl;
|
||||
@ -856,10 +862,10 @@ int unterOption_info(Settings *settings, int argc, char **argv)
|
||||
std::string portStr = optarg.substr(optarg.find(":") + 1, optarg.length() - optarg.find(":"));
|
||||
int port = atoi(portStr.c_str());
|
||||
if(std::to_string(port) != portStr || port <= 0) {
|
||||
std::cout << "[-p]: Invalid Port: " << portStr << std::endl;
|
||||
std::cout << " => Error: [-p]: Invalid Port: " << portStr << std::endl;
|
||||
return 32;
|
||||
} else if (ip == "") {
|
||||
std::cout << "[-p]: Invalid Ip Addresse: " << ip << std::endl;
|
||||
std::cout << " => Error: [-p]: Invalid Ip Addresse: " << ip << std::endl;
|
||||
return 34;
|
||||
} else if(settings->debugMode) {
|
||||
std::cout << "Proxy Addresse: "<< ip << ":" << port << std::endl;
|
||||
|
@ -38,7 +38,7 @@ struct Settings {
|
||||
proxy_ip = "127.0.0.1",
|
||||
languages = "GerDub,GerSub,Eng",
|
||||
genaueHoster = "",
|
||||
version = "2.5.0",
|
||||
version = "2.5.1",
|
||||
defaultFileVersion="1.3",
|
||||
outputFilePath = "",
|
||||
default_checkPath = "",
|
||||
|
Loading…
Reference in New Issue
Block a user