Don't spawn new connections if we are full

This commit is contained in:
Frank Denis 2020-09-17 00:49:49 +02:00
parent 8411e5a91b
commit 4d7f253e6b
1 changed files with 4 additions and 0 deletions

View File

@ -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