From b5036266beedd6311a1fffb1c1bc84a6910e164a Mon Sep 17 00:00:00 2001 From: Guenter Obiltschnig Date: Wed, 5 Oct 2016 09:23:02 +0200 Subject: [PATCH] backported #1445: Use stable_sort to preserve order of IP addresses from DNS --- Net/src/SocketAddress.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Net/src/SocketAddress.cpp b/Net/src/SocketAddress.cpp index ac3da51f0..e595457c6 100644 --- a/Net/src/SocketAddress.cpp +++ b/Net/src/SocketAddress.cpp @@ -236,7 +236,7 @@ void SocketAddress::init(const std::string& hostAddress, Poco::UInt16 portNumber { #if defined(POCO_HAVE_IPv6) // if we get both IPv4 and IPv6 addresses, prefer IPv4 - std::sort(addresses.begin(), addresses.end(), AFLT()); + std::stable_sort(addresses.begin(), addresses.end(), AFLT()); #endif init(addresses[0], portNumber); }