diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc index 2a755379468..0da59e095e1 100644 --- a/proxy/http/HttpProxyServerMain.cc +++ b/proxy/http/HttpProxyServerMain.cc @@ -56,6 +56,10 @@ std::mutex proxyServerMutex; std::condition_variable proxyServerCheck; bool et_net_threads_ready = false; +std::mutex etUdpMutex; +std::condition_variable etUdpCheck; +bool et_udp_threads_ready = false; + extern int num_of_net_threads; extern int num_accept_threads; @@ -322,6 +326,15 @@ init_HttpProxyServer() lock.unlock(); proxyServerCheck.notify_one(); } + +#if TS_USE_QUIC == 1 + if (eventProcessor.has_tg_started(ET_UDP)) { + std::unique_lock lock(etUdpMutex); + et_udp_threads_ready = true; + lock.unlock(); + etUdpCheck.notify_one(); + } +#endif } void diff --git a/proxy/http/HttpProxyServerMain.h b/proxy/http/HttpProxyServerMain.h index 1de9ced2e98..46f59aa1841 100644 --- a/proxy/http/HttpProxyServerMain.h +++ b/proxy/http/HttpProxyServerMain.h @@ -52,3 +52,7 @@ NetProcessor::AcceptOptions make_net_accept_options(const HttpProxyPort *port, u extern std::mutex proxyServerMutex; extern std::condition_variable proxyServerCheck; extern bool et_net_threads_ready; + +extern std::mutex etUdpMutex; +extern std::condition_variable etUdpCheck; +extern bool et_udp_threads_ready; diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index 4f54e9846ce..c251698e83b 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -2098,6 +2098,7 @@ main(int /* argc ATS_UNUSED */, const char **argv) } if (num_of_udp_threads) { udpNet.start(num_of_udp_threads, stacksize); + eventProcessor.thread_group[ET_UDP]._afterStartCallback = init_HttpProxyServer; } // Initialize Response Body Factory @@ -2135,6 +2136,12 @@ main(int /* argc ATS_UNUSED */, const char **argv) proxyServerCheck.wait(lock, [] { return et_net_threads_ready; }); } +#if TS_USE_QUIC == 1 + if (num_of_udp_threads) { + std::unique_lock lock(etUdpMutex); + etUdpCheck.wait(lock, [] { return et_udp_threads_ready; }); + } +#endif // Delay only if config value set and flag value is zero // (-1 => cache already initialized) if (delay_p && ink_atomic_cas(&delay_listen_for_cache, 0, 1)) {