]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Make the protocol const, simplify the TCP/UDP check
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 2 Jul 2021 13:11:40 +0000 (15:11 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 2 Jul 2021 13:11:40 +0000 (15:11 +0200)
pdns/dnsdist.hh

index 153eee4e12a16a8276aae08942f222bd66f9961b..2f379ed73d0a803fcfe413f9b7f54ed2906a5873 100644 (file)
@@ -126,8 +126,7 @@ struct DNSQuestion
 
   bool overTCP() const
   {
-    const std::set<Protocol> 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;