From 4d7f253e6b8daf6bb260dfe667799e70e094080c Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 17 Sep 2020 00:49:49 +0200 Subject: [PATCH] Don't spawn new connections if we are full --- dnscrypt-proxy/plugin_dns64.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dnscrypt-proxy/plugin_dns64.go b/dnscrypt-proxy/plugin_dns64.go index 442683b9..96240c10 100644 --- a/dnscrypt-proxy/plugin_dns64.go +++ b/dnscrypt-proxy/plugin_dns64.go @@ -84,7 +84,11 @@ func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error return err } + if !plugin.proxy.clientsCountInc() { + return errors.New("Too many concurrent connections to handle DNS64 subqueries") + } respPacket := plugin.proxy.processIncomingQuery("trampoline", plugin.proxy.mainProto, msgAPacket, nil, nil, time.Now()) + plugin.proxy.clientsCountDec() resp := dns.Msg{} if err := resp.Unpack(respPacket); err != nil { return err