Do not sort endpoint addresses
Defeats purpose of best-first ordering in DNS reply.
This commit is contained in:
parent
f585130355
commit
d0de93c60a
|
@ -125,7 +125,7 @@ class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
|
|||
builder.resolvedAddresses = [address]
|
||||
} else {
|
||||
builder.prefersResolvedAddresses = !preferences.resolvesHostname
|
||||
builder.resolvedAddresses = pool.addresses(sorted: false)
|
||||
builder.resolvedAddresses = pool.addresses()
|
||||
}
|
||||
|
||||
if let proto = manualProtocol {
|
||||
|
@ -158,7 +158,7 @@ extension ProviderConnectionProfile {
|
|||
}
|
||||
|
||||
var addresses: [String] {
|
||||
return pool?.addresses(sorted: true) ?? []
|
||||
return pool?.addresses() ?? []
|
||||
}
|
||||
|
||||
var protocols: [EndpointProtocol] {
|
||||
|
|
|
@ -61,10 +61,8 @@ struct Pool: Codable, Comparable, CustomStringConvertible {
|
|||
}
|
||||
|
||||
// XXX: inefficient, can't easily use lazy on struct
|
||||
func addresses(sorted: Bool) -> [String] {
|
||||
var addrs = (sorted ? numericAddresses.sorted() : numericAddresses).map {
|
||||
return DNSResolver.string(fromIPv4: $0)
|
||||
}
|
||||
func addresses() -> [String] {
|
||||
var addrs = numericAddresses.map { DNSResolver.string(fromIPv4: $0) }
|
||||
addrs.insert(hostname, at: 0)
|
||||
return addrs
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue