diff options
Diffstat (limited to 'ace/SOCK.cpp')
-rw-r--r-- | ace/SOCK.cpp | 92 |
1 files changed, 16 insertions, 76 deletions
diff --git a/ace/SOCK.cpp b/ace/SOCK.cpp index 67a10d44d64..010b1c1f986 100644 --- a/ace/SOCK.cpp +++ b/ace/SOCK.cpp @@ -54,22 +54,6 @@ ACE_SOCK::get_local_addr (ACE_Addr &sa) const return 0; } -// Close down a ACE_SOCK. - -int -ACE_SOCK::close (void) -{ - ACE_TRACE ("ACE_SOCK::close"); - int result = 0; - - if (this->get_handle () != ACE_INVALID_HANDLE) - { - result = ACE_OS::closesocket (this->get_handle ()); - this->set_handle (ACE_INVALID_HANDLE); - } - return result; -} - int ACE_SOCK::open (int type, int protocol_family, @@ -85,8 +69,8 @@ ACE_SOCK::open (int type, if (this->get_handle () == ACE_INVALID_HANDLE) return -1; - else if (protocol_family != PF_UNIX - && reuse_addr + else if (protocol_family != PF_UNIX && + reuse_addr && this->set_option (SOL_SOCKET, SO_REUSEADDR, &one, @@ -98,76 +82,32 @@ ACE_SOCK::open (int type, return 0; } -// General purpose constructor for performing server ACE_SOCK -// creation. - -ACE_SOCK::ACE_SOCK (int type, - int protocol_family, - int protocol, - int reuse_addr) -{ - // ACE_TRACE ("ACE_SOCK::ACE_SOCK"); - if (this->open (type, - protocol_family, - protocol, - reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("%p\n"), - ASYS_TEXT ("ACE_SOCK::ACE_SOCK"))); -} +// Close down a ACE_SOCK. int -ACE_SOCK::open (int type, - int protocol_family, - int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr) +ACE_SOCK::close (void) { - ACE_TRACE ("ACE_SOCK::open"); - - this->set_handle (ACE_OS::socket (protocol_family, - type, - protocol, - protocolinfo, - g, - flags)); - - int one = 1; + ACE_TRACE ("ACE_SOCK::close"); + int result = 0; - if (this->get_handle () == ACE_INVALID_HANDLE) - return -1; - else if (reuse_addr - && this->set_option (SOL_SOCKET, - SO_REUSEADDR, - &one, - sizeof one) == -1) + if (this->get_handle () != ACE_INVALID_HANDLE) { - this->close (); - return -1; + result = ACE_OS::closesocket (this->get_handle ()); + this->set_handle (ACE_INVALID_HANDLE); } - return 0; + return result; } +// General purpose constructor for performing server ACE_SOCK +// creation. + ACE_SOCK::ACE_SOCK (int type, int protocol_family, int protocol, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, int reuse_addr) { // ACE_TRACE ("ACE_SOCK::ACE_SOCK"); - if (this->open (type, - protocol_family, - protocol, - protocolinfo, - g, - flags, - reuse_addr) == -1) - ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("%p\n"), - ASYS_TEXT ("ACE_SOCK::ACE_SOCK"))); + if (this->open (type, protocol_family, + protocol, reuse_addr) == -1) + ACE_ERROR ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE_SOCK::ACE_SOCK"))); } - |