1616int main (int argc, char *argv[])
1717{
1818#ifdef __cpp_lib_format
19- std::cout << std::format (" {} version 20250301 \n " , app_name);
19+ std::cout << std::format (" {} version 20250406 \n " , app_name);
2020 if (argc <= 1 )
2121 {
2222 std::cout << std::format (" Usage: {} config1.conf\n " , app_name);
2323 std::cout << std::format (" {} config1.conf config2.conf...\n " , (int )app_name.length (), app_name.data ());
2424 return 0 ;
2525 }
2626#else
27- std::cout << app_name << " version 20250301 \n " ;
27+ std::cout << app_name << " version 20250406 \n " ;
2828 if (argc <= 1 )
2929 {
3030 std::cout << " Usage: " << app_name << " config1.conf\n " ;
@@ -33,33 +33,34 @@ int main(int argc, char *argv[])
3333 }
3434#endif
3535
36- uint16_t thread_group_count = 2 ;
37- int io_thread_count = std::thread::hardware_concurrency () == 1 ? 1 : 2 ;
38- std::unique_ptr<ttp::task_thread_pool> parallel_pool_1;
39- std::unique_ptr<ttp::task_thread_pool> parallel_pool_2;
40- if (std::thread::hardware_concurrency () > 2 )
41- {
42- auto thread_counts = std::thread::hardware_concurrency ();
43- thread_group_count = thread_counts;
44- io_thread_count = (int )round (log2 (thread_counts));
45- }
46-
47- if (std::thread::hardware_concurrency () > 1 )
48- {
49- parallel_pool_1 = std::make_unique<ttp::task_thread_pool>();
50- parallel_pool_2 = std::make_unique<ttp::task_thread_pool>();
51- }
52-
53- ttp::task_group_pool task_groups{ thread_group_count };
54- task_pool_colloector task_pools =
55- {
56- .parallel_encryption_pool = parallel_pool_1.get (),
57- .parallel_decryption_pool = parallel_pool_2.get (),
58- .listener_parallels = parallel_pool_1.get (),
59- .forwarder_parallels = parallel_pool_2.get ()
60- };
61-
62- asio::io_context ioc{ io_thread_count };
36+ // uint16_t thread_group_count = 2;
37+ // int io_thread_count = std::thread::hardware_concurrency() == 1 ? 1 : 2;
38+ // std::unique_ptr<ttp::task_thread_pool> parallel_pool_1;
39+ // std::unique_ptr<ttp::task_thread_pool> parallel_pool_2;
40+ // if (std::thread::hardware_concurrency() > 2)
41+ // {
42+ // auto thread_counts = std::thread::hardware_concurrency();
43+ // thread_group_count = thread_counts;
44+ // io_thread_count = (int)round(log2(thread_counts));
45+ // }
46+
47+ // if (std::thread::hardware_concurrency() > 1)
48+ // {
49+ // parallel_pool_1 = std::make_unique<ttp::task_thread_pool>();
50+ // parallel_pool_2 = std::make_unique<ttp::task_thread_pool>();
51+ // }
52+
53+ // ttp::task_group_pool task_groups{ thread_group_count };
54+ // task_pool_colloector task_pools =
55+ // {
56+ // .parallel_encryption_pool = parallel_pool_1.get(),
57+ // .parallel_decryption_pool = parallel_pool_2.get(),
58+ // .listener_parallels = parallel_pool_1.get(),
59+ // .forwarder_parallels = parallel_pool_2.get()
60+ // };
61+
62+ // asio::io_context ioc{ io_thread_count };
63+ asio::io_context ioc;
6364
6465 std::vector<client_mode> clients;
6566 std::vector<relay_mode> relays;
@@ -117,13 +118,13 @@ int main(int argc, char *argv[])
117118 switch (settings.mode )
118119 {
119120 case running_mode::client:
120- clients.emplace_back (client_mode (ioc, task_groups, task_pools, settings));
121+ clients.emplace_back (client_mode (ioc, /* task_groups, task_pools,*/ settings));
121122 break ;
122123 case running_mode::relay:
123- relays.emplace_back (relay_mode (ioc, task_groups, task_pools, settings));
124+ relays.emplace_back (relay_mode (ioc, /* task_groups, task_pools,*/ settings));
124125 break ;
125126 case running_mode::server:
126- servers.emplace_back (server_mode (ioc, task_groups, task_pools, settings));
127+ servers.emplace_back (server_mode (ioc, /* task_groups, task_pools,*/ settings));
127128 break ;
128129 default :
129130 break ;
0 commit comments