From 333eeb6370dd9a7c6343a981af5e369258bcea11 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 2 Jul 2021 15:11:40 +0200 Subject: [PATCH] dnsdist: Make the protocol const, simplify the TCP/UDP check --- pdns/dnsdist.hh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pdns/dnsdist.hh b/pdns/dnsdist.hh index 153eee4e12..2f379ed73d 100644 --- a/pdns/dnsdist.hh +++ b/pdns/dnsdist.hh @@ -126,8 +126,7 @@ struct DNSQuestion bool overTCP() const { - const std::set tcpProto = { Protocol::DoTCP, Protocol::DNSCryptTCP, Protocol::DoT, Protocol::DoH }; - return tcpProto.count(protocol); + return !(protocol == Protocol::DoUDP || protocol == Protocol::DNSCryptUDP); } protected: @@ -162,7 +161,7 @@ public: const uint16_t qclass; uint16_t ecsPrefixLength; uint16_t origFlags; - Protocol protocol; + const Protocol protocol; uint8_t ednsRCode{0}; bool skipCache{false}; bool ecsOverride; -- 2.47.2