diff options
author | Jack Lloyd <[email protected]> | 2018-05-09 18:07:21 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-05-09 18:07:21 -0400 |
commit | bef5303b3ec1a17bc79ccce0eecdca4874639b56 (patch) | |
tree | 0f994fe8cb4deae1ce7fc390f0bdc1d560a80f47 /src/cli/tls_proxy.cpp | |
parent | dcc2a6161ab4f6da160cd0705fa10117e35fb6e0 (diff) |
Properly set thread counts in asio TLS servers
X || Y || 2 always evaluates to 1...
Diffstat (limited to 'src/cli/tls_proxy.cpp')
-rw-r--r-- | src/cli/tls_proxy.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cli/tls_proxy.cpp b/src/cli/tls_proxy.cpp index ed7ee5645..717bbc6c6 100644 --- a/src/cli/tls_proxy.cpp +++ b/src/cli/tls_proxy.cpp @@ -421,6 +421,15 @@ class TLS_Proxy final : public Command return "Proxies requests between a TLS client and a TLS server"; } + size_t thread_count() const + { + if(size_t t = get_arg_sz("threads")) + return t; + if(size_t t = std::thread::hardware_concurrency()) + return t; + return 2; + } + void go() override { const size_t listen_port = get_arg_sz("listen_port"); @@ -430,7 +439,7 @@ class TLS_Proxy final : public Command const std::string server_crt = get_arg("server_cert"); const std::string server_key = get_arg("server_key"); - const size_t num_threads = get_arg_sz("threads") || std::thread::hardware_concurrency() || 2; + const size_t num_threads = thread_count(); Basic_Credentials_Manager creds(rng(), server_crt, server_key); |