From: Otto Moerbeek Date: Thu, 24 Oct 2024 06:26:35 +0000 (+0200) Subject: Merge pull request #14773 from omoerbeek/backport-14628-to-rec-5.1.x X-Git-Tag: rec-5.1.3~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c97e155992c66d0dc0e5a0508e1699b0e2410ed;p=thirdparty%2Fpdns.git Merge pull request #14773 from omoerbeek/backport-14628-to-rec-5.1.x rec: Backport 14628 to rec 5.1.x: rec: avoid duplicated waiter ids for chained requests --- 0c97e155992c66d0dc0e5a0508e1699b0e2410ed diff --cc pdns/recursordist/pdns_recursor.cc index e636cf57a8,4f5f26046a..3aed8c4fcd --- a/pdns/recursordist/pdns_recursor.cc +++ b/pdns/recursordist/pdns_recursor.cc @@@ -305,17 -305,17 +305,17 @@@ LWResult::Result asendto(const void* da assert(chain.first->key->domain == pident->domain); // NOLINT // don't chain onto existing chained waiter or a chain already processed if (chain.first->key->fd > -1 && !chain.first->key->closed) { - *fileDesc = -1; // gets used in waitEvent / sendEvent later on auto currentChainSize = chain.first->key->authReqChain.size(); + *fileDesc = -static_cast(currentChainSize + 1); // value <= -1, gets used in waitEvent / sendEvent later on if (g_maxChainLength > 0 && currentChainSize >= g_maxChainLength) { - return LWResult::Result::OSLimitError; + return LWResult::Result::ChainLimitError; } assert(uSec(chain.first->key->creationTime) != 0); // NOLINT auto age = now - chain.first->key->creationTime; if (uSec(age) > static_cast(1000) * authWaitTimeMSec(g_multiTasker) * 2 / 3) { - return LWResult::Result::OSLimitError; + return LWResult::Result::ChainLimitError; } - chain.first->key->authReqChain.insert(qid); // we can chain + chain.first->key->authReqChain.emplace(*fileDesc, qid); // we can chain auto maxLength = t_Counters.at(rec::Counter::maxChainLength); if (currentChainSize > maxLength) { t_Counters.at(rec::Counter::maxChainLength) = currentChainSize;