summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1999-01-03 21:48:41 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1999-01-03 21:48:41 +0000
commit63d66fe2d238e461706adc9a17108cebbc613748 (patch)
tree25a4dc53aac9c6338b8ed446276ec035b028c18e /ace
parentc9fdc2d4abb8e28f8460f3c8c1043084207bb2a3 (diff)
downloadATCD-63d66fe2d238e461706adc9a17108cebbc613748.tar.gz
.
Diffstat (limited to 'ace')
-rw-r--r--ace/Asynch_Acceptor.cpp71
-rw-r--r--ace/Auto_Ptr.h3
-rw-r--r--ace/Containers_T.h3
-rw-r--r--ace/FILE_Addr.cpp3
-rw-r--r--ace/FILE_Addr.h2
-rw-r--r--ace/FILE_Connector.cpp21
-rw-r--r--ace/OS.h15
-rw-r--r--ace/SOCK_Connector.cpp7
8 files changed, 89 insertions, 36 deletions
diff --git a/ace/Asynch_Acceptor.cpp b/ace/Asynch_Acceptor.cpp
index 3f92569b94e..823ae3bd77c 100644
--- a/ace/Asynch_Acceptor.cpp
+++ b/ace/Asynch_Acceptor.cpp
@@ -60,15 +60,19 @@ ACE_Asynch_Acceptor<HANDLER>::open (const ACE_INET_Addr &address,
// Create the listener socket
this->listen_handle_ = ACE_OS::socket (PF_INET, SOCK_STREAM, 0);
if (this->listen_handle_ == ACE_INVALID_HANDLE)
- ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE_OS::socket")), -1);
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("ACE_OS::socket")),
+ -1);
// Initialize the ACE_Asynch_Accept
if (this->asynch_accept_.open (*this,
this->listen_handle_,
0,
this->proactor ()) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE_Asynch_Accept::open")), -1);
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("ACE_Asynch_Accept::open")),
+ -1);
if (reuse_addr)
{
// Reuse the address
@@ -78,14 +82,20 @@ ACE_Asynch_Acceptor<HANDLER>::open (const ACE_INET_Addr &address,
SO_REUSEADDR,
(const char*) &one,
sizeof one) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE_OS::setsockopt")), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("ACE_OS::setsockopt")),
+ -1);
}
// If port is not specified, bind to any port.
static ACE_INET_Addr sa ((const ACE_INET_Addr &) ACE_Addr::sap_any);
if (address == sa && ACE::bind_port (this->listen_handle_) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE::bind_port")), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("ACE::bind_port")),
+ -1);
// Bind to the specified port.
if (ACE_OS::bind (this->listen_handle_,
@@ -101,7 +111,8 @@ ACE_Asynch_Acceptor<HANDLER>::open (const ACE_INET_Addr &address,
if (ACE_OS::listen (this->listen_handle_, backlog) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"%p\n",
- "ACE_OS::listen"), -1);
+ "ACE_OS::listen"),
+ -1);
// For the number of <intial_accepts>.
if (number_of_initial_accepts == -1)
@@ -128,7 +139,9 @@ ACE_Asynch_Acceptor<HANDLER>::set_handle (ACE_HANDLE listen_handle)
this->listen_handle_,
0,
this->proactor ()) == -1)
- ACE_ERROR ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE_Asynch_Accept::open")));
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("ACE_Asynch_Accept::open")));
}
template <class HANDLER> ACE_HANDLE
@@ -144,7 +157,9 @@ ACE_Asynch_Acceptor<HANDLER>::accept (size_t bytes_to_read, const void *act)
size_t space_needed = bytes_to_read + 2 * this->address_size ();
// Create a new message block big enough for the addresses and data
- ACE_NEW_RETURN (message_block, ACE_Message_Block (space_needed), -1);
+ ACE_NEW_RETURN (message_block,
+ ACE_Message_Block (space_needed),
+ -1);
// Initiate asynchronous accepts
if (this->asynch_accept_.accept (*message_block,
@@ -154,7 +169,10 @@ ACE_Asynch_Acceptor<HANDLER>::accept (size_t bytes_to_read, const void *act)
{
// Cleanup on error
message_block->release ();
- ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("ACE_Asynch_Accept::accept")), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("ACE_Asynch_Accept::accept")),
+ -1);
}
return 0;
}
@@ -174,7 +192,9 @@ ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &re
!result.success ())
{
error = 1;
- ACE_ERROR ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("AcceptEx")));
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("AcceptEx")));
}
#if !defined (ACE_HAS_AIO_CALLS)
@@ -191,7 +211,9 @@ ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &re
sizeof (this->listen_handle_)) == -1)
{
error = 1;
- ACE_ERROR ((LM_ERROR, ASYS_TEXT ("%p"), ASYS_TEXT ("ACE_OS::setsockopt")));
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT ("%p"),
+ ASYS_TEXT ("ACE_OS::setsockopt")));
}
#endif /* ACE_HAS_AIO_CALLS */
@@ -212,7 +234,9 @@ ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &re
this->validate_new_connection (remote_address) == -1)
{
error = 1;
- ACE_ERROR ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("Address validation failed")));
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("Address validation failed")));
}
HANDLER *new_handler = 0;
@@ -223,7 +247,9 @@ ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &re
if (new_handler == 0)
{
error = 1;
- ACE_ERROR ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("Making of new handler failed")));
+ ACE_ERROR ((LM_ERROR,
+ ASYS_TEXT ("%p\n"),
+ ASYS_TEXT ("Making of new handler failed")));
}
}
@@ -235,15 +261,12 @@ ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &re
// Pass the addresses
if (this->pass_addresses_)
- {
- new_handler->addresses (remote_address, local_address);
- }
+ new_handler->addresses (remote_address,
+ local_address);
// Pass the ACT
if (result.act () != 0)
- {
- new_handler->act (result.act ());
- }
+ new_handler->act (result.act ());
// Initiate the handler
new_handler->open (result.accept_handle (),
@@ -252,18 +275,14 @@ ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &re
// On failure, no choice but to close the socket
if (error)
- {
- ACE_OS::closesocket (result.accept_handle ());
- }
+ ACE_OS::closesocket (result.accept_handle ());
// Delete the dynamically allocated message_block
result.message_block ().release ();
// Start off another asynchronous accept to keep the backlog going
if (this->should_reissue_accept ())
- {
- this->accept (this->bytes_to_read_);
- }
+ this->accept (this->bytes_to_read_);
#endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) || (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) || defined (ACE_HAS_AIO_CALLS */
}
diff --git a/ace/Auto_Ptr.h b/ace/Auto_Ptr.h
index c5960096af6..32cf674dcf5 100644
--- a/ace/Auto_Ptr.h
+++ b/ace/Auto_Ptr.h
@@ -81,7 +81,8 @@ class ACE_Auto_Basic_Array_Ptr
// = TITLE
// Implements an extension to the draft C++ standard auto_ptr
// abstraction. This class allows one to work on non-object
- // (basic) types
+ // (basic) types that must be treated as an array, e.g.,
+ // deallocated via "delete [] foo".
public:
// = Initialization and termination methods.
/* explicit */ ACE_Auto_Basic_Array_Ptr (X *p = 0);
diff --git a/ace/Containers_T.h b/ace/Containers_T.h
index c1e2508d443..ba109847df9 100644
--- a/ace/Containers_T.h
+++ b/ace/Containers_T.h
@@ -342,7 +342,8 @@ class ACE_Unbounded_Stack_Iterator
// Implement an iterator over an unbounded Stack.
public:
// = Initialization method.
- ACE_Unbounded_Stack_Iterator (ACE_Unbounded_Stack<T> &);
+ ACE_Unbounded_Stack_Iterator (ACE_Unbounded_Stack<T> &stack);
+ // Move to the first element in the <stack>.
// = Iteration methods.
diff --git a/ace/FILE_Addr.cpp b/ace/FILE_Addr.cpp
index 8f5de4e41fe..3aa24e4796a 100644
--- a/ace/FILE_Addr.cpp
+++ b/ace/FILE_Addr.cpp
@@ -38,7 +38,7 @@ ACE_FILE_Addr::ACE_FILE_Addr (const ACE_FILE_Addr &sa)
this->set (sa);
}
-void
+int
ACE_FILE_Addr::set (LPCTSTR filename)
{
this->ACE_Addr::base_set (AF_FILE,
@@ -46,6 +46,7 @@ ACE_FILE_Addr::set (LPCTSTR filename)
(void) ACE_OS::strncpy (this->filename_,
filename,
sizeof this->filename_);
+ return 0;
}
ACE_FILE_Addr &
diff --git a/ace/FILE_Addr.h b/ace/FILE_Addr.h
index 04f37a63236..cb2111e55ef 100644
--- a/ace/FILE_Addr.h
+++ b/ace/FILE_Addr.h
@@ -43,7 +43,7 @@ public:
ACE_FILE_Addr (LPCTSTR filename);
// Create a ACE_FILE_Addr from a pathname.
- void set (LPCTSTR filename);
+ int set (LPCTSTR filename);
// Create a ACE_FILE_Addr from a pathname.
ACE_FILE_Addr &operator= (const ACE_FILE_Addr &);
diff --git a/ace/FILE_Connector.cpp b/ace/FILE_Connector.cpp
index f3b61c7406d..e4a63b72824 100644
--- a/ace/FILE_Connector.cpp
+++ b/ace/FILE_Connector.cpp
@@ -39,11 +39,26 @@ ACE_FILE_Connector::connect (ACE_FILE_IO &new_io,
ACE_TRACE ("ACE_FILE_Connector::connect");
ACE_ASSERT (new_io.get_handle () == ACE_INVALID_HANDLE);
+ // Check to see if caller has requested that we create the filename.
+ if (ACE_reinterpret_cast (const ACE_Addr &,
+ ACE_const_cast (ACE_FILE_Addr &,
+ remote_sap)) == ACE_Addr::sap_any)
+ {
+ ACE_FILE_Addr temp_sap (ACE_DEFAULT_TEMP_FILE);
+
+ // Create a temporary file.
+ ACE_OS::mktemp (ACE_const_cast (TCHAR *,
+ temp_sap.get_path_name ()));
+ new_io.addr_ = temp_sap; // class copy.
+ }
+ else
+ new_io.addr_ = remote_sap; // class copy.
+
ACE_HANDLE handle = ACE::handle_timed_open (timeout,
- remote_sap.get_path_name (),
- flags, perms);
+ new_io.addr_.get_path_name (),
+ flags,
+ perms);
new_io.set_handle (handle);
- new_io.addr_ = remote_sap; // class copy.
return handle == ACE_INVALID_HANDLE ? -1 : 0;
}
diff --git a/ace/OS.h b/ace/OS.h
index dd21ba97561..d251c3228af 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -750,6 +750,11 @@ typedef struct
# define ACE_DEFAULT_BACKING_STORE "/tmp/ace-malloc-XXXXXX"
# endif /* ACE_DEFAULT_BACKING_STORE */
+// Used for ACE_FILE_Connector
+# if !defined (ACE_DEFAULT_TEMP_FILE)
+# define ACE_DEFAULT_TEMP_FILE "/tmp/ace-file-XXXXXX"
+# endif /* ACE_DEFAULT_TEMP_FILE */
+
// Used for logging
# if !defined (ACE_DEFAULT_LOGFILE)
# define ACE_DEFAULT_LOGFILE "/tmp/logfile"
@@ -2747,6 +2752,11 @@ typedef void (*ACE_SignalHandlerV)(...);
# define ACE_DEFAULT_BACKING_STORE ACE_TEXT ("C:\\temp\\ace-malloc-XXXXXX")
# endif /* ACE_DEFAULT_BACKING_STORE */
+// Used for ACE_FILE_Connector
+# if !defined (ACE_DEFAULT_TEMP_FILE)
+# define ACE_DEFAULT_TEMP_FILE "C:\\temp\\ace-file-XXXXXX"
+# endif /* ACE_DEFAULT_TEMP_FILE */
+
// Used for logging
# if !defined (ACE_DEFAULT_LOGFILE)
# define ACE_DEFAULT_LOGFILE "C:\\temp\\logfile"
@@ -3130,6 +3140,11 @@ typedef char TCHAR;
# define ACE_DEFAULT_BACKING_STORE "/tmp/ace-malloc-XXXXXX"
# endif /* ACE_DEFAULT_BACKING_STORE */
+// Used for ACE_FILE_Connector
+# if !defined (ACE_DEFAULT_TEMP_FILE)
+# define ACE_DEFAULT_TEMP_FILE "/tmp/ace-file-XXXXXX"
+# endif /* ACE_DEFAULT_TEMP_FILE */
+
// Used for logging
# if !defined (ACE_DEFAULT_LOGFILE)
# define ACE_DEFAULT_LOGFILE "/tmp/logfile"
diff --git a/ace/SOCK_Connector.cpp b/ace/SOCK_Connector.cpp
index 8adb709493b..0d2c4ddabb5 100644
--- a/ace/SOCK_Connector.cpp
+++ b/ace/SOCK_Connector.cpp
@@ -1,7 +1,6 @@
// SOCK_Connector.cpp
// $Id$
-
#define ACE_BUILD_DLL
#include "ace/SOCK_Connector.h"
#include "ace/Handle_Set.h"
@@ -9,7 +8,7 @@
#if defined (ACE_LACKS_INLINE_FUNCTIONS)
#include "ace/SOCK_Connector.i"
-#endif
+#endif /* ACE_LACKS_INLINE_FUNCTIONS */
ACE_RCSID(ace, SOCK_Connector, "$Id$")
@@ -52,7 +51,9 @@ ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
{
sockaddr *laddr = (sockaddr *) local_sap.get_addr ();
size_t size = local_sap.get_size ();
- result = ACE_OS::bind (new_stream.get_handle (), laddr, size);
+ result = ACE_OS::bind (new_stream.get_handle (),
+ laddr,
+ size);
if (result == -1)
{