From 05e59526d6f26b1b0fb99fa411f6f3aeb5ed6757 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 1 Oct 2021 15:16:25 +0200 Subject: [PATCH] dnsdist: Try to work around a TSAN false positive tcpMaxConcurrentConnections is an indicative metric, we don't really care if there is a small race here. --- pdns/dnsdist-tcp.cc | 4 ++-- pdns/dnsdistdist/doh.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index a8d8971154..cf69ed1d89 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -1323,8 +1323,8 @@ void tcpAcceptorThread(ClientState* cs) continue; } - if (concurrentConnections > cs->tcpMaxConcurrentConnections) { - cs->tcpMaxConcurrentConnections = concurrentConnections; + if (concurrentConnections > cs->tcpMaxConcurrentConnections.load()) { + cs->tcpMaxConcurrentConnections.store(concurrentConnections); } if (ci->fd < 0) { diff --git a/pdns/dnsdistdist/doh.cc b/pdns/dnsdistdist/doh.cc index 6301727a37..5737b7fb6e 100644 --- a/pdns/dnsdistdist/doh.cc +++ b/pdns/dnsdistdist/doh.cc @@ -1369,8 +1369,8 @@ static void on_accept(h2o_socket_t *listener, const char *err) return; } - if (concurrentConnections > dsc->cs->tcpMaxConcurrentConnections) { - dsc->cs->tcpMaxConcurrentConnections = concurrentConnections; + if (concurrentConnections > dsc->cs->tcpMaxConcurrentConnections.load()) { + dsc->cs->tcpMaxConcurrentConnections.store(concurrentConnections); } auto& conn = t_conns[descriptor]; -- 2.47.2