fix for GH #1449: you can now compile Net with -DPOCO_SOCKETADDRESS_DONT_PREFER_IPV4 to prevent SocketAddress from preferring IPv4 over IPv6 addresses

This commit is contained in:
Guenter Obiltschnig 2016-10-10 19:14:01 +02:00
parent cefab1f993
commit 946e00b77d
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ public:
SocketAddress(const IPAddress& hostAddress, Poco::UInt16 portNumber);
/// Creates a SocketAddress from an IP address and given port number.
SocketAddress(Poco::UInt16 port);
explicit SocketAddress(Poco::UInt16 port);
/// Creates a SocketAddress with unspecified (wildcard) IP address
/// and given port number.

View File

@ -234,7 +234,7 @@ void SocketAddress::init(const std::string& hostAddress, Poco::UInt16 portNumber
HostEntry::AddressList addresses = he.addresses();
if (addresses.size() > 0)
{
#if defined(POCO_HAVE_IPv6)
#if defined(POCO_HAVE_IPv6) && !defined(POCO_SOCKETADDRESS_DONT_PREFER_IPV4)
// if we get both IPv4 and IPv6 addresses, prefer IPv4
std::stable_sort(addresses.begin(), addresses.end(), AFLT());
#endif