diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-01-07 03:32:28 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-01-07 03:32:28 +0000 |
commit | b56d7267775487402358a0bce5ea8eb51c35cb1c (patch) | |
tree | 0f2ef9bbacc53194bcf76e66a137e424a997fd1b | |
parent | 857cee336733438c2d0dd23d0d5575a76c0ad43a (diff) | |
download | ATCD-b56d7267775487402358a0bce5ea8eb51c35cb1c.tar.gz |
moving
-rw-r--r-- | ace/MEM_Acceptor.cpp | 8 | ||||
-rw-r--r-- | ace/MEM_Connector.cpp | 30 |
2 files changed, 31 insertions, 7 deletions
diff --git a/ace/MEM_Acceptor.cpp b/ace/MEM_Acceptor.cpp index 8af89b5ae5a..07edbc31ec6 100644 --- a/ace/MEM_Acceptor.cpp +++ b/ace/MEM_Acceptor.cpp @@ -134,9 +134,15 @@ ACE_MEM_Acceptor::shared_accept_finish (ACE_MEM_Stream new_stream, ACE_INET_Addr local_addr; if (new_stream.get_local_addr (local_addr) == -1) return -1; + + // @@ Need to make the filename prefix configurable. Perhaps we + // should have something like ACE_MEM_Addr? ACE_OS::sprintf (buf, "MEM_Acceptor_%d_", local_addr.get_port_number ()); ACE_OS::unique_name (this, buf, MAXPATHLEN); + // Make sure we have a fresh start. + ACE_OS::unlink (buf); + // Now set up the shared memory malloc pool. if (new_stream.create_shm_malloc (buf) == -1) return -1; @@ -145,7 +151,7 @@ ACE_MEM_Acceptor::shared_accept_finish (ACE_MEM_Stream new_stream, ACE_UINT16 buf_len = ACE_OS::strlen (buf) + 1; // No need to worry about byte-order because both parties should always - // on the same machine. + // be on the same machine. if (ACE::send (new_handle, &buf_len, sizeof (ACE_UINT16)) == -1) return -1; diff --git a/ace/MEM_Connector.cpp b/ace/MEM_Connector.cpp index 77e98aa9090..a46daf8283f 100644 --- a/ace/MEM_Connector.cpp +++ b/ace/MEM_Connector.cpp @@ -66,12 +66,30 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream, ACE_TRACE ("ACE_MEM_Connector::connect"); ACE_SOCK_Stream temp_stream; - int result = ACE_SOCK_Connector::connect (temp_stream, remote_sap, - timeout, local_sap, - reuse_addr, flags, perms, - protocol_family, protocol); + if (ACE_SOCK_Connector::connect (temp_stream, remote_sap, + timeout, local_sap, + reuse_addr, flags, perms, + protocol_family, protocol) == -1) + return -1; - new_stream.set_handle (temp_stream.get_handle ()); + ACE_HANDLE new_handle = temp_stream.get_handle (); + new_stream.set_handle (new_handle); // Do not close the handle. - return result; + + // now we should setup the mmap malloc. + char buf[MAXPATHLEN]; + + // @@ Need to handle timeout here. + ACE_INT16 buf_len; + // Byte-order is not a problem for this read. + if (ACE::recv (new_handle, &buf_len, sizeof (buf_len)) == -1) + return -1; + + if (ACE::recv (new_handle, buf, buf_len) == -1) + return -1; + + if (new_stream.create_shm_malloc (buf) == -1) + return -1; + + return 0; } |