* newSuffixMatchNode(): returns a new SuffixMatchNode
* member `check(DNSName)`: returns true if DNSName is matched by this group
* member `add(DNSName)`: add this DNSName to the node
+ * Tuning related:
+ * setTCPRecvTimeout(n): set the read timeout on TCP connections from the client, in seconds.
+ * setTCPSendTimeout(n): set the write timeout on TCP connections from the client, in seconds.
+ * setMaxTCPClientThreads(n): set the maximum of TCP client threads, handling TCP connections.
+ * setMaxUDPOutstanding(n): set the maximum number of outstanding UDP queries to a given backend server. This can only be set at configuration time.
All hooks
---------
g_lua.writeFunction("setTCPSendTimeout", [](int timeout) { g_tcpSendTimeout=timeout; });
+ g_lua.writeFunction("setMaxUDPOutstanding", [](uint16_t max) {
+ if (!g_configurationDone) {
+ g_maxOutstanding = max;
+ } else {
+ g_outputBuffer="Max UDP outstanding cannot be altered at runtime!\n";
+ }
+ });
+
+ g_lua.writeFunction("setMaxTCPClientThreads", [](uint64_t max) { g_maxTCPClientThreads = max; });
+
g_lua.writeFunction("dumpStats", [] {
vector<string> leftcolumn, rightcolumn;
return false;
}
+std::atomic<uint64_t> g_maxTCPClientThreads{10};
+
void* maintThread()
{
int interval = 1;
for(;;) {
sleep(interval);
- if(g_tcpclientthreads.d_queued > 1 && g_tcpclientthreads.d_numthreads < 10)
+ if(g_tcpclientthreads.d_queued > 1 && g_tcpclientthreads.d_numthreads < g_maxTCPClientThreads)
g_tcpclientthreads.addTCPClientThread();
for(auto& dss : g_dstates.getCopy()) { // this points to the actual shared_ptrs!
vector<string> words{"showRules()", "shutdown()", "rmRule(", "mvRule(", "addACL(", "addLocal(", "setServerPolicy(", "setServerPolicyLua(",
"newServer(", "rmServer(", "showServers()", "show(", "newDNSName(", "newSuffixMatchNode(", "controlSocket(", "topClients(", "showResponseLatency()",
"newQPSLimiter(", "makeKey()", "setKey(", "testCrypto()", "addAnyTCRule()", "showServerPolicy()", "setACL(", "showACL()", "addDomainBlock(",
- "addPoolRule(", "addQPSLimit(", "topResponses(", "topQueries(", "topRule()", "setDNSSECPool(", "addDelay("};
+ "addPoolRule(", "addQPSLimit(", "topResponses(", "topQueries(", "topRule()", "setDNSSECPool(", "addDelay(",
+ "setMaxUDPOutstanding(", "setMaxTCPClientThreads("};
static int s_counter=0;
int counter=0;
if(!state)
string gid;
} g_cmdLine;
+std::atomic<bool> g_configurationDone{false};
int main(int argc, char** argv)
try
g_locals.push_back({ComboAddress("127.0.0.1", 53), true});
+ g_configurationDone = true;
+
vector<ClientState*> toLaunch;
for(const auto& local : g_locals) {
ClientState* cs = new ClientState;
extern bool g_truncateTC;
extern int g_tcpRecvTimeout;
extern int g_tcpSendTimeout;
+extern uint16_t g_maxOutstanding;
+extern std::atomic<bool> g_configurationDone;
+extern std::atomic<uint64_t> g_maxTCPClientThreads;
struct dnsheader;
void controlThread(int fd, ComboAddress local);