mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
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:
parent
cefab1f993
commit
946e00b77d
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user