From 544acdf04eba759fee0aaa19dbcc500ea6e13963 Mon Sep 17 00:00:00 2001 From: Pierre Souchay Date: Thu, 31 May 2018 18:15:52 +0200 Subject: [PATCH] Fixed comments for max DNS records returned as requested by @mkeeler --- agent/dns.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/agent/dns.go b/agent/dns.go index 85c977768..524f99581 100644 --- a/agent/dns.go +++ b/agent/dns.go @@ -752,11 +752,12 @@ func (d *DNSServer) trimTCPResponse(req, resp *dns.Msg) (trimmed bool) { originalSize := resp.Len() originalNumRecords := len(resp.Answer) - // Beyond 2500 records, performance gets bad - // Limit the number of records at once, anyway, it won't fit in 64k - // For SRV Records, the max is around 500 records, for A, less than 2k + // It is not possible to return more than 4k records even with compression + // Since we are performing binary search it is not a big deal, but it + // improves a bit performance, even with binary search truncateAt := 4096 if req.Question[0].Qtype == dns.TypeSRV { + // More than 1024 SRV records do not fit in 64k truncateAt = 1024 } if len(resp.Answer) > truncateAt {