}
handleQueuedHealthChecks(mplexer, true);
+ /* we need to create the TCP worker threads before the
+ acceptor ones, otherwise we might crash when processing
+ the first TCP query */
+ while (!g_tcpclientthreads->hasReachedMaxThreads()) {
+ g_tcpclientthreads->addTCPClientThread();
+ }
+
for(auto& cs : g_frontends) {
if (cs->dohFrontend != nullptr) {
#ifdef HAVE_DNS_OVER_HTTPS
}
}
- while (!g_tcpclientthreads->hasReachedMaxThreads()) {
- g_tcpclientthreads->addTCPClientThread();
- }
-
thread carbonthread(carbonDumpThread);
carbonthread.detach();
}
int getThread()
{
+ if (d_numthreads == 0) {
+ throw std::runtime_error("No TCP worker thread yet");
+ }
+
uint64_t pos = d_pos++;
++d_queued;
return d_tcpclientthreads.at(pos % d_numthreads);