mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 01:37:00 +00:00
Some missing from merge.
Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
parent
ec939a5bce
commit
f4be15a7af
1895 changed files with 160408 additions and 53601 deletions
|
|
@ -1,3 +1,5 @@
|
|||
// $Id: SOCK_Acceptor.cpp 97459 2013-12-12 00:22:03Z mesnier_p $
|
||||
|
||||
#include "ace/SOCK_Acceptor.h"
|
||||
|
||||
#include "ace/Log_Category.h"
|
||||
|
|
@ -5,9 +7,6 @@
|
|||
#include "ace/OS_NS_string.h"
|
||||
#include "ace/OS_NS_sys_socket.h"
|
||||
#include "ace/os_include/os_fcntl.h"
|
||||
#if defined (ACE_HAS_ALLOC_HOOKS)
|
||||
# include "ace/Malloc_Base.h"
|
||||
#endif /* ACE_HAS_ALLOC_HOOKS */
|
||||
|
||||
#if !defined (__ACE_INLINE__)
|
||||
#include "ace/SOCK_Acceptor.inl"
|
||||
|
|
@ -221,15 +220,12 @@ ACE_SOCK_Acceptor::dump (void) const
|
|||
int
|
||||
ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap,
|
||||
int protocol_family,
|
||||
int backlog,
|
||||
int ipv6_only)
|
||||
int backlog)
|
||||
{
|
||||
ACE_TRACE ("ACE_SOCK_Acceptor::shared_open");
|
||||
int error = 0;
|
||||
|
||||
#if !defined (ACE_HAS_IPV6)
|
||||
ACE_UNUSED_ARG (ipv6_only);
|
||||
#else /* defined (ACE_HAS_IPV6) */
|
||||
#if defined (ACE_HAS_IPV6)
|
||||
if (protocol_family == PF_INET6)
|
||||
{
|
||||
sockaddr_in6 local_inet6_addr;
|
||||
|
|
@ -246,31 +242,29 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap,
|
|||
else
|
||||
local_inet6_addr = *reinterpret_cast<sockaddr_in6 *> (local_sap.get_addr ());
|
||||
|
||||
/*
|
||||
* Handle IPv6-only requests. On Windows, v6-only is the default
|
||||
* unless it is turned off. On Linux, v4/v6 dual is the default
|
||||
* unless v6-only is turned on.
|
||||
* This must be done before attempting to bind the address.
|
||||
* On Windows older than Vista this will fail.
|
||||
*/
|
||||
int setting = !!ipv6_only;
|
||||
if (-1 == ACE_OS::setsockopt (this->get_handle (),
|
||||
IPPROTO_IPV6,
|
||||
IPV6_V6ONLY,
|
||||
(char *)&setting,
|
||||
sizeof (setting)))
|
||||
# if defined (ACE_WIN32)
|
||||
// on windows vista and later, Winsock can support dual stack sockets
|
||||
// but this must be explicitly set prior to the bind. Since this
|
||||
// behavior is the default on *nix platforms, it should be benigh to
|
||||
// just do it here. On older platforms the setsockopt will fail, but
|
||||
// that should be OK.
|
||||
int zero = 0;
|
||||
ACE_OS::setsockopt (this->get_handle (),
|
||||
IPPROTO_IPV6,
|
||||
IPV6_V6ONLY,
|
||||
(char *)&zero,
|
||||
sizeof (zero));
|
||||
# endif /* ACE_WIN32 */
|
||||
// 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 (),
|
||||
reinterpret_cast<sockaddr *> (&local_inet6_addr),
|
||||
sizeof local_inet6_addr) == -1)
|
||||
error = 1;
|
||||
else
|
||||
// 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 (),
|
||||
reinterpret_cast<sockaddr *> (&local_inet6_addr),
|
||||
sizeof local_inet6_addr) == -1)
|
||||
error = 1;
|
||||
}
|
||||
else
|
||||
#endif /* ACE_HAS_IPV6 */
|
||||
#endif
|
||||
if (protocol_family == PF_INET)
|
||||
{
|
||||
sockaddr_in local_inet_addr;
|
||||
|
|
@ -320,8 +314,7 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
|
|||
int reuse_addr,
|
||||
int protocol_family,
|
||||
int backlog,
|
||||
int protocol,
|
||||
int ipv6_only)
|
||||
int protocol)
|
||||
{
|
||||
ACE_TRACE ("ACE_SOCK_Acceptor::open");
|
||||
|
||||
|
|
@ -339,8 +332,7 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
|
|||
else
|
||||
return this->shared_open (local_sap,
|
||||
protocol_family,
|
||||
backlog,
|
||||
ipv6_only);
|
||||
backlog);
|
||||
}
|
||||
|
||||
ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
|
||||
|
|
@ -350,8 +342,7 @@ ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
|
|||
int reuse_addr,
|
||||
int protocol_family,
|
||||
int backlog,
|
||||
int protocol,
|
||||
int ipv6_only)
|
||||
int protocol)
|
||||
{
|
||||
ACE_TRACE ("ACE_SOCK_Acceptor::ACE_SOCK_Acceptor");
|
||||
if (this->open (local_sap,
|
||||
|
|
@ -361,8 +352,7 @@ ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
|
|||
reuse_addr,
|
||||
protocol_family,
|
||||
backlog,
|
||||
protocol,
|
||||
ipv6_only) == -1)
|
||||
protocol) == -1)
|
||||
ACELIB_ERROR ((LM_ERROR,
|
||||
ACE_TEXT ("%p\n"),
|
||||
ACE_TEXT ("ACE_SOCK_Acceptor")));
|
||||
|
|
@ -375,8 +365,7 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
|
|||
int reuse_addr,
|
||||
int protocol_family,
|
||||
int backlog,
|
||||
int protocol,
|
||||
int ipv6_only)
|
||||
int protocol)
|
||||
{
|
||||
ACE_TRACE ("ACE_SOCK_Acceptor::open");
|
||||
|
||||
|
|
@ -399,8 +388,7 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap,
|
|||
else
|
||||
return this->shared_open (local_sap,
|
||||
protocol_family,
|
||||
backlog,
|
||||
ipv6_only);
|
||||
backlog);
|
||||
}
|
||||
|
||||
// General purpose routine for performing server ACE_SOCK creation.
|
||||
|
|
@ -409,16 +397,14 @@ ACE_SOCK_Acceptor::ACE_SOCK_Acceptor (const ACE_Addr &local_sap,
|
|||
int reuse_addr,
|
||||
int protocol_family,
|
||||
int backlog,
|
||||
int protocol,
|
||||
int ipv6_only)
|
||||
int protocol)
|
||||
{
|
||||
ACE_TRACE ("ACE_SOCK_Acceptor::ACE_SOCK_Acceptor");
|
||||
if (this->open (local_sap,
|
||||
reuse_addr,
|
||||
protocol_family,
|
||||
backlog,
|
||||
protocol,
|
||||
ipv6_only) == -1)
|
||||
protocol) == -1)
|
||||
ACELIB_ERROR ((LM_ERROR,
|
||||
ACE_TEXT ("%p\n"),
|
||||
ACE_TEXT ("ACE_SOCK_Acceptor")));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue