diff options
Diffstat (limited to 'ace/SOCK_Acceptor.cpp')
-rw-r--r-- | ace/SOCK_Acceptor.cpp | 71 |
1 files changed, 28 insertions, 43 deletions
diff --git a/ace/SOCK_Acceptor.cpp b/ace/SOCK_Acceptor.cpp index 20e44d1debd..37e2cef3c61 100644 --- a/ace/SOCK_Acceptor.cpp +++ b/ace/SOCK_Acceptor.cpp @@ -209,34 +209,34 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap, ACE_TRACE ("ACE_SOCK_Acceptor::shared_open"); int error = 0; - #if defined (ACE_HAS_IPV6) - if (protocol_family == PF_INET6) - { - sockaddr_in6 local_inet6_addr; - ACE_OS::memset (ACE_reinterpret_cast (void *, - &local_inet6_addr), - 0, - sizeof local_inet6_addr); - - if (local_sap == ACE_Addr::sap_any) - { - local_inet6_addr.sin6_family = AF_INET6; - local_inet6_addr.sin6_port = 0; - local_inet6_addr.sin6_addr = in6addr_any; - } - else - local_inet6_addr = *ACE_reinterpret_cast (sockaddr_in6 *, - local_sap.get_addr ()); - - // We probably don't need a bind_port written here. - // There are currently no supported OS's that define ACE_LACKS_WILDCARD_BIND. - if (ACE_OS::bind (this->get_handle (), - ACE_reinterpret_cast (sockaddr *, - &local_inet6_addr), - sizeof local_inet6_addr) == -1) - error = 1; - } else - #endif +#if defined (ACE_HAS_IPV6) + if (protocol_family == PF_INET6) + { + sockaddr_in6 local_inet6_addr; + ACE_OS::memset (ACE_reinterpret_cast (void *, + &local_inet6_addr), + 0, + sizeof local_inet6_addr); + + if (local_sap == ACE_Addr::sap_any) + { + local_inet6_addr.sin6_family = AF_INET6; + local_inet6_addr.sin6_port = 0; + local_inet6_addr.sin6_addr = in6addr_any; + } + else + local_inet6_addr = *ACE_reinterpret_cast (sockaddr_in6 *, + local_sap.get_addr ()); + + // We probably don't need a bind_port written here. + // There are currently no supported OS's that define ACE_LACKS_WILDCARD_BIND. + if (ACE_OS::bind (this->get_handle (), + ACE_reinterpret_cast (sockaddr *, + &local_inet6_addr), + sizeof local_inet6_addr) == -1) + error = 1; + } else +#endif if (protocol_family == PF_INET) { sockaddr_in local_inet_addr; @@ -293,15 +293,6 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap, { ACE_TRACE ("ACE_SOCK_Acceptor::open"); - // For AF_INET6 addresses we need PF_INET6 sockets in order to - // properly bind to IPv6 addresses. -#if defined (ACE_HAS_IPV6) - if(local_sap.get_type() == AF_INET6 || - local_sap.get_type() == AF_ANY) { - protocol_family = PF_INET6; - } -#endif - if (ACE_SOCK::open (SOCK_STREAM, protocol_family, protocol, @@ -350,12 +341,6 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap, { ACE_TRACE ("ACE_SOCK_Acceptor::open"); -#if defined (ACE_HAS_IPV6) - if(local_sap.get_type() == AF_INET6 || - local_sap.get_type() == AF_ANY) - protocol_family = PF_INET6; -#endif - if (ACE_SOCK::open (SOCK_STREAM, protocol_family, protocol, |