diff --git a/src/net/tools/naive/naive_proxy.cc b/src/net/tools/naive/naive_proxy.cc index a38f791249..b4d5feee68 100644 --- a/src/net/tools/naive/naive_proxy.cc +++ b/src/net/tools/naive/naive_proxy.cc @@ -5,6 +5,7 @@ #include "net/tools/naive/naive_proxy.h" +#include #include #include "base/bind.h" @@ -34,7 +35,7 @@ NaiveProxy::NaiveProxy(std::unique_ptr listen_socket, const NetworkTrafficAnnotationTag& traffic_annotation) : listen_socket_(std::move(listen_socket)), protocol_(protocol), - concurrency_(concurrency), + concurrency_(std::min(4, std::max(1, concurrency))), resolver_(resolver), session_(session), net_log_( diff --git a/src/net/tools/naive/naive_proxy_bin.cc b/src/net/tools/naive/naive_proxy_bin.cc index 00acd7756b..4ba08712dd 100644 --- a/src/net/tools/naive/naive_proxy_bin.cc +++ b/src/net/tools/naive/naive_proxy_bin.cc @@ -289,7 +289,7 @@ bool ParseCommandLine(const CommandLine& cmdline, Params* params) { if (!cmdline.concurrency.empty()) { if (!base::StringToInt(cmdline.concurrency, ¶ms->concurrency) || - params->concurrency < 1) { + params->concurrency < 1 || params->concurrency > 4) { std::cerr << "Invalid concurrency" << std::endl; return false; }