diff options
author | Steve Huston <shuston@riverace.com> | 2015-04-02 18:54:13 -0400 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2015-04-02 18:54:13 -0400 |
commit | a4433e8cd7456f1d4c228097b7c537d4f138e196 (patch) | |
tree | a5a8aac59a827c56c9fcdbb1f37d3a851aff7597 /ACE/ace/INET_Addr.cpp | |
parent | 80ed354efaa6f59d064ef5ec849ae1ea8d00fc30 (diff) | |
download | ATCD-a4433e8cd7456f1d4c228097b7c537d4f138e196.tar.gz |
Avoid copying in multiples of the same address but having different socktypes
Diffstat (limited to 'ACE/ace/INET_Addr.cpp')
-rw-r--r-- | ACE/ace/INET_Addr.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ACE/ace/INET_Addr.cpp b/ACE/ace/INET_Addr.cpp index 365367507b9..9e8dfb22f3a 100644 --- a/ACE/ace/INET_Addr.cpp +++ b/ACE/ace/INET_Addr.cpp @@ -415,6 +415,13 @@ ACE_INET_Addr::set (u_short port_number, int error = 0; ACE_OS::memset (&hints, 0, sizeof (hints)); hints.ai_family = AF_INET6; + // Note - specify the socktype here to avoid getting multiple entries + // returned with the same address for different socket types or + // protocols. If this causes a problem for some reason (an address that's + // available for TCP but not UDP, or vice-versa) this will need to change + // back to unrestricted hints and weed out the duplicate addresses by + // searching this->inet_addrs_ which would slow things down. + hints.ai_socktype = SOCK_STREAM; if ((error = ::getaddrinfo (host_name, 0, &hints, &res)) == 0) { this->set_type (res->ai_family); |