summaryrefslogtreecommitdiff
path: root/ace/SOCK.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1999-07-03 19:13:21 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1999-07-03 19:13:21 +0000
commitb905399700cdb47211c8b004e64717824d019035 (patch)
tree7b7968f868dee77552a559d93156665ec0756edb /ace/SOCK.cpp
parentdded054c6a2dd6522fb9daf07c291b7196169547 (diff)
downloadATCD-b905399700cdb47211c8b004e64717824d019035.tar.gz
.
Diffstat (limited to 'ace/SOCK.cpp')
-rw-r--r--ace/SOCK.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/ace/SOCK.cpp b/ace/SOCK.cpp
index 33810aec98f..67a10d44d64 100644
--- a/ace/SOCK.cpp
+++ b/ace/SOCK.cpp
@@ -85,8 +85,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,
@@ -122,7 +122,8 @@ ACE_SOCK::open (int type,
int protocol,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
- u_long flags)
+ u_long flags,
+ int reuse_addr)
{
ACE_TRACE ("ACE_SOCK::open");
@@ -133,8 +134,19 @@ ACE_SOCK::open (int type,
g,
flags));
+ int one = 1;
+
if (this->get_handle () == ACE_INVALID_HANDLE)
return -1;
+ else if (reuse_addr
+ && this->set_option (SOL_SOCKET,
+ SO_REUSEADDR,
+ &one,
+ sizeof one) == -1)
+ {
+ this->close ();
+ return -1;
+ }
return 0;
}
@@ -143,7 +155,8 @@ ACE_SOCK::ACE_SOCK (int type,
int protocol,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
- u_long flags)
+ u_long flags,
+ int reuse_addr)
{
// ACE_TRACE ("ACE_SOCK::ACE_SOCK");
if (this->open (type,
@@ -151,7 +164,8 @@ ACE_SOCK::ACE_SOCK (int type,
protocol,
protocolinfo,
g,
- flags) == -1)
+ flags,
+ reuse_addr) == -1)
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("%p\n"),
ASYS_TEXT ("ACE_SOCK::ACE_SOCK")));