optimise response construction when no truncation is required
no need to do a binary search if all the answers fit
This commit is contained in:
1 parent
2ea27ec08f
commit
9a7abe68fd
1 file changed
+2
-2
+2
-2
@@ -246,10 +246,10 @@ func (h *handler) makeResponse(req *dns.Msg, answers []dns.RR) *dns.Msg {
|
||||
response.SetReply(req)
|
||||
response.RecursionAvailable = true
|
||||
response.Authoritative = true
|
||||
response.Answer = answers
|
||||
|
||||
maxSize := h.getMaxResponseSize(req)
|
||||
if len(answers) <= 1 || maxSize <= 0 {
|
||||
response.Answer = answers
|
||||
if len(answers) <= 1 || maxSize <= 0 || response.Len() <= maxSize {
|
||||
return response
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user