Commit d809ec6c authored by Evan Hunt's avatar Evan Hunt Committed by Ondřej Surý
Browse files

restore allowance for tcp-clients < interfaces

in the "refactor tcpquota and pipeline refs" commit, the counting
of active interfaces was tightened in such a way that named could
fail to listen on an interface if there were more interfaces than
tcp-clients. when checking the quota to start accepting on an
interface, if the number of active clients was above zero, then
it was presumed that some other client was able to handle accepting
new connections. this, however, ignored the fact that the current client
could be included in that count, so if the quota was already exceeded
before all the interfaces were listening, some interfaces would never

we now check whether the current client has been marked active; if so,
then the number of active clients on the interface must be greater
than 1, not 0.

(cherry picked from commit 02365b87ea0b1ea5ea8b17376f6734c811c95e61)
(cherry picked from commit cae79e1b)
parent 2f3876d1
......@@ -8252,7 +8252,8 @@ avoid-v6-udp-ports { 40000; range 50000 60000; };
The number of file descriptors reserved for TCP, stdio,
etc. This needs to be big enough to cover the number of
interfaces <command>named</command> listens on, <command>tcp-clients</command> as well as
interfaces <command>named</command> listens on plus
<command>tcp-clients</command>, as well as
to provide room for outgoing TCP queries and incoming zone
transfers. The default is <literal>512</literal>.
The minimum value is <literal>128</literal> and the
......@@ -3439,8 +3439,9 @@ client_accept(ns_client_t *client) {
* So, we check here to see if any other clients are
* already servicing TCP queries on this interface (whether
* accepting, reading, or processing). If we find at least
* one, then it's okay *not* to call accept - we can let this
* accepting, reading, or processing). If we find that at
* least one client other than this one is active, then
* it's okay *not* to call accept - we can let this
* client go inactive and another will take over when it's
* done.
......@@ -3454,7 +3455,8 @@ client_accept(ns_client_t *client) {
* quota is tcp-clients plus the number of listening
* interfaces plus 1.)
exit = (atomic_load(&client->interface->ntcpactive) > 0U);
exit = (atomic_load(&client->interface->ntcpactive) >
(client->tcpactive ? 1U : 0U));
if (exit) {
client->newstate = NS_CLIENTSTATE_INACTIVE;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment