mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
backported #1445: Use stable_sort to preserve order of IP addresses from DNS
This commit is contained in:
parent
0e0fac80b6
commit
b5036266be
@ -236,7 +236,7 @@ void SocketAddress::init(const std::string& hostAddress, Poco::UInt16 portNumber
|
|||||||
{
|
{
|
||||||
#if defined(POCO_HAVE_IPv6)
|
#if defined(POCO_HAVE_IPv6)
|
||||||
// if we get both IPv4 and IPv6 addresses, prefer IPv4
|
// 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
|
#endif
|
||||||
init(addresses[0], portNumber);
|
init(addresses[0], portNumber);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user