ACE_MEM_Stream
object.
More...
#include <MEM_Connector.h>
Inheritance diagram for ACE_MEM_Connector:
Public Types | |
typedef ACE_INET_Addr | PEER_ADDR |
typedef ACE_MEM_Stream | PEER_STREAM |
Public Member Functions | |
ACE_MEM_Connector (void) | |
Default constructor. | |
ACE_MEM_Connector (ACE_MEM_Stream &new_stream, const ACE_INET_Addr &remote_sap, ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, int reuse_addr=0, int flags=0, int perms=0) | |
int | connect (ACE_MEM_Stream &new_stream, const ACE_INET_Addr &remote_sap, ACE_Time_Value *timeout=0, const ACE_Addr &local_sap=ACE_Addr::sap_any, int reuse_addr=0, int flags=0, int perms=0) |
ACE_MEM_IO::Signal_Strategy | preferred_strategy (void) const |
Get the preferred signaling strategy. | |
void | preferred_strategy (ACE_MEM_IO::Signal_Strategy strategy) |
Set the preferred signaling strategy. | |
ACE_MEM_SAP::MALLOC_OPTIONS & | malloc_options (void) |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Private Attributes | |
ACE_MEM_Addr | address_ |
The acceptor address this connector is connecting to. | |
ACE_MEM_SAP::MALLOC_OPTIONS | malloc_options_ |
ACE_MEM_IO::Signal_Strategy | preferred_strategy_ |
Preferred signaling strategy. |
ACE_MEM_Stream
object.
Definition at line 37 of file MEM_Connector.h.
|
Reimplemented from ACE_SOCK_Connector. Definition at line 149 of file MEM_Connector.h. |
|
Reimplemented from ACE_SOCK_Connector. Definition at line 150 of file MEM_Connector.h. |
|
Default constructor.
Definition at line 30 of file MEM_Connector.cpp. References ACE_DEFAULT_BASE_ADDR, and ACE_TRACE.
00031 : malloc_options_ (ACE_DEFAULT_BASE_ADDR, 0), 00032 preferred_strategy_ (ACE_MEM_IO::Reactive) 00033 { 00034 ACE_TRACE ("ACE_MEM_Connector::ACE_MEM_Connector"); 00035 } |
|
Actively connect to a peer, producing a connected
Definition at line 38 of file MEM_Connector.cpp. References ACE_DEFAULT_BASE_ADDR, ACE_TRACE, and connect().
00045 : malloc_options_ (ACE_DEFAULT_BASE_ADDR, 0), 00046 preferred_strategy_ (ACE_MEM_IO::Reactive) 00047 { 00048 ACE_TRACE ("ACE_MEM_Connector::ACE_MEM_Connector"); 00049 // This is necessary due to the weird inheritance relationships of 00050 // ACE_MEM_Stream. 00051 this->connect (new_stream, 00052 remote_sap, 00053 timeout, 00054 local_sap, 00055 reuse_addr, 00056 flags, 00057 perms); 00058 } |
|
Actively connect to a peer, producing a connected
Definition at line 61 of file MEM_Connector.cpp. References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_NONBLOCK, ACE_TCHAR, ACE_TEXT_CHAR_TO_TCHAR, ACE_TRACE, address_, ACE_SOCK_Connector::connect(), ACE_IPC_SAP::disable(), ACE_IPC_SAP::get_handle(), ACE_INET_Addr::get_host_name(), ACE_SOCK::get_local_addr(), ACE_MEM_Addr::get_port_number(), ACE_INET_Addr::get_port_number(), ACE_MEM_IO::init(), LM_DEBUG, LM_ERROR, MAXPATHLEN, ACE::recv(), ACE_MEM_Addr::same_host(), ACE::send(), ACE_IPC_SAP::set_handle(), and ACE_MEM_Addr::set_port_number(). Referenced by ACE_MEM_Connector().
00068 { 00069 ACE_TRACE ("ACE_MEM_Connector::connect"); 00070 00071 if (!this->address_.same_host (remote_sap)) 00072 ACE_ERROR_RETURN ((LM_ERROR, 00073 ACE_LIB_TEXT ("(%P|%t) MEM_Connector can't connect ") 00074 ACE_LIB_TEXT ("to %s:%d which is not a local endpoint ") 00075 ACE_LIB_TEXT ("(local address is %s:%d)\n"), 00076 ACE_TEXT_CHAR_TO_TCHAR (remote_sap.get_host_name ()), 00077 remote_sap.get_port_number (), 00078 ACE_TEXT_CHAR_TO_TCHAR (this->address_.get_host_name ()), 00079 this->address_.get_port_number ()), 00080 -1); 00081 else 00082 this->address_.set_port_number (remote_sap.get_port_number ()); 00083 00084 00085 ACE_SOCK_Stream temp_stream; 00086 00087 if (ACE_SOCK_Connector::connect (temp_stream, 00088 this->address_.get_local_addr (), 00089 timeout, local_sap, 00090 reuse_addr, flags, perms) == -1) 00091 ACE_ERROR_RETURN ((LM_DEBUG, 00092 ACE_LIB_TEXT ("%p\n"), 00093 ACE_LIB_TEXT ("ACE_MEM_Connector::connect")), 00094 -1); 00095 00096 00097 ACE_HANDLE new_handle = temp_stream.get_handle (); 00098 new_stream.set_handle (new_handle); 00099 new_stream.disable (ACE_NONBLOCK); 00100 // Do not close the handle. 00101 00102 // now we should setup the mmap malloc. 00103 ACE_TCHAR buf[MAXPATHLEN]; 00104 00105 // @@ Need to handle timeout here. 00106 ACE_INT16 server_strategy = ACE_MEM_IO::Reactive; 00107 // Receive the signaling strategy theserver support. 00108 if (ACE::recv (new_handle, &server_strategy, 00109 sizeof (ACE_INT16)) == -1) 00110 ACE_ERROR_RETURN ((LM_DEBUG, 00111 ACE_LIB_TEXT ("ACE_MEM_Connector::connect error receiving strategy\n")), 00112 -1); 00113 00114 // If either side don't support MT, we will not use it. 00115 #if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM) 00116 if (! (this->preferred_strategy_ == ACE_MEM_IO::MT && 00117 server_strategy == ACE_MEM_IO::MT)) 00118 #endif /* ACE_WIN32 || !_ACE_USE_SV_SEM */ 00119 server_strategy = ACE_MEM_IO::Reactive; 00120 00121 if (ACE::send (new_handle, &server_strategy, 00122 sizeof (ACE_INT16)) == -1) 00123 ACE_ERROR_RETURN ((LM_DEBUG, 00124 ACE_LIB_TEXT ("ACE_MEM_Connector::connect error sending strategy\n")), 00125 -1); 00126 00127 ACE_INT16 buf_len; 00128 // Byte-order is not a problem for this read. 00129 if (ACE::recv (new_handle, &buf_len, sizeof (buf_len)) == -1) 00130 ACE_ERROR_RETURN ((LM_DEBUG, 00131 ACE_LIB_TEXT ("ACE_MEM_Connector::connect error receiving shm filename length\n")), 00132 -1); 00133 00134 if (ACE::recv (new_handle, buf, buf_len) == -1) 00135 ACE_ERROR_RETURN ((LM_DEBUG, 00136 ACE_LIB_TEXT ("ACE_MEM_Connector::connect error receiving shm filename.\n")), 00137 -1); 00138 00139 if (new_stream.init (buf, 00140 static_cast<ACE_MEM_IO::Signal_Strategy> (server_strategy), 00141 &this->malloc_options_) == -1) 00142 return -1; 00143 00144 return 0; 00145 } |
|
Dump the state of an object.
Reimplemented from ACE_SOCK_Connector. Definition at line 19 of file MEM_Connector.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, and LM_DEBUG.
|
|
Accessor to underlying malloc options.
Definition at line 22 of file MEM_Connector.inl.
00023 { 00024 // @@ This function has been deprecated and will be removed in the 00025 // future. 00026 00027 return this->malloc_options_; 00028 } |
|
Set the preferred signaling strategy.
Definition at line 16 of file MEM_Connector.inl.
00017 { 00018 this->preferred_strategy_ = strategy; 00019 } |
|
Get the preferred signaling strategy.
Definition at line 10 of file MEM_Connector.inl.
00011 { 00012 return this->preferred_strategy_; 00013 } |
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_SOCK_Connector. Definition at line 156 of file MEM_Connector.h. |
|
The acceptor address this connector is connecting to.
Definition at line 160 of file MEM_Connector.h. Referenced by connect(). |
|
A cached MALLOC_OPTIONS that the MEM_Connector used to initialize the shared memory malloc update connection establishment. Definition at line 164 of file MEM_Connector.h. |
|
Preferred signaling strategy.
Definition at line 167 of file MEM_Connector.h. |