From 689f16f0d75f42b3f672ab5d2cdce52c912c2312 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Fri, 9 Oct 2020 22:01:37 +0800 Subject: [PATCH] Revert "Remove concurrency limit" This reverts commit f1a49736010170a70123db07ca41256ba92c0002. This iss actually mistakenly added due to incorrect test setup. --- src/net/tools/naive/naive_proxy.cc | 3 ++- src/net/tools/naive/naive_proxy_bin.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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; }