hackney icon indicating copy to clipboard operation
hackney copied to clipboard

remove sort of dns responses

Open albertasi opened this issue 3 months ago • 0 comments

This PR stops sorting the resolver’s address list in hackney_happy:getbyname/2 by replacing lists:usort(AddrList) with AddrList. The current sorting removes duplicates and reorders IPs, which unintentionally breaks DNS randomness and can cause uneven connection distribution.

Rationale DNS randomness is a common, simple load-spreading mechanism. Reordering results undermines it. Duplicate handling is typically the resolver’s responsibility. If duplicates occur, they are rare and harmless; removing them here is not worth the cost of losing order.

albertasi avatar Nov 13 '25 11:11 albertasi