@@ -100,6 +100,8 @@ int udp_timeout;
100100int tcp_timeout;
101101int rate_limit;
102102
103+ std::string asio_config;
104+
103105// ////////////////////////////////////////////////////////////////////////
104106
105107net::awaitable<void >
@@ -386,6 +388,8 @@ int main(int argc, char** argv)
386388
387389 (" scramble" , po::value<bool >(&scramble)->value_name (" " )->default_value (false , " false" ), " Noise-based data security." )
388390 (" noise_length" , po::value<uint16_t >(&noise_length)->value_name (" length" )->default_value (0x0fff ), " Length of the noise data." )
391+
392+ (" asio_config" , po::value<std::string>(&asio_config)->value_name (" enable asio config env" )->default_value (" ASIO" ), " Enable asio config from environment variables." )
389393 ;
390394
391395 // 解析命令行.
@@ -452,14 +456,7 @@ and/or open issues at https://github.com/Jackarain/proxy)"
452456 for (const auto & server_listen : server_listens)
453457 XLOG_DBG << " Start server: " << server_listen;
454458
455- auto cfg = net::config_from_string (
456- " scheduler.concurrency_hint=1\n "
457- " scheduler.locking_spin_count=1\n "
458- " scheduler.locking=0\n "
459- " reactor.registration_locking=0\n "
460- " reactor.preallocated_io_objects=128\n "
461- " reactor.io_locking=0"
462- );
459+ auto cfg = net::config_from_env (asio_config);
463460 net::io_context ioc (cfg);
464461 net::signal_set terminator_signal (ioc);
465462 server_ptr server;
0 commit comments