#include <IIOP_SSL_Connector.h>
Inheritance diagram for TAO::IIOP_SSL_Connector:
Concrete instance of the TAO_Connector class. Responsible for establishing a connection with a server and is called from the Connector_Registry.
Definition at line 43 of file IIOP_SSL_Connector.h.
|
Reimplemented in TAO::SSLIOP::Connector. Definition at line 70 of file IIOP_SSL_Connector.h. |
|
Reimplemented in TAO::SSLIOP::Connector. Definition at line 59 of file IIOP_SSL_Connector.h. Referenced by open(). |
|
Reimplemented in TAO::SSLIOP::Connector. Definition at line 62 of file IIOP_SSL_Connector.h. Referenced by open(). |
|
Reimplemented in TAO::SSLIOP::Connector. Definition at line 66 of file IIOP_SSL_Connector.h. |
|
Constructor.
Definition at line 23 of file IIOP_SSL_Connector.cpp.
00024 : TAO_IIOP_Connector (flag), 00025 connect_strategy_ (), 00026 base_connector_ () 00027 { 00028 } |
|
Destructor.
Definition at line 30 of file IIOP_SSL_Connector.cpp.
00031 { 00032 } |
|
Reimplemented from TAO_IIOP_Connector. Reimplemented in TAO::SSLIOP::Connector. Definition at line 275 of file IIOP_SSL_Connector.cpp. References ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::cancel().
00277 { 00278 IIOP_SSL_Connection_Handler* handler= 00279 dynamic_cast<IIOP_SSL_Connection_Handler*> (svc_handler); 00280 00281 if (handler) 00282 // Cancel from the connector 00283 return this->base_connector_.cancel (handler); 00284 00285 return -1; 00286 } |
|
Reimplemented from TAO_IIOP_Connector. Reimplemented in TAO::SSLIOP::Connector. Definition at line 67 of file IIOP_SSL_Connector.cpp. References ACE_Strategy_Connector< SVC_HANDLER, >::close(), ACE_Strategy_Connector< SVC_HANDLER, >::concurrency_strategy(), and ACE_Strategy_Connector< SVC_HANDLER, >::creation_strategy(). Referenced by TAO::SSLIOP::Connector::close().
00068 { 00069 delete this->base_connector_.creation_strategy (); 00070 delete this->base_connector_.concurrency_strategy (); 00071 return this->base_connector_.close (); 00072 } |
|
Reimplemented from TAO_IIOP_Connector. Definition at line 110 of file IIOP_SSL_Connector.cpp. References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), TAO::Profile_Transport_Resolver::blocked_connect(), TAO::Transport_Cache_Manager::cache_transport(), TAO_IIOP_Connection_Handler::close(), TAO_Transport::close_connection(), ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::connect(), TAO_Transport_Descriptor_Interface::endpoint(), EWOULDBLOCK, TAO_IIOP_Endpoint::host(), TAO_Transport::id(), TAO_Transport::is_connected(), TAO_ORB_Core::lane_resources(), LM_DEBUG, LM_ERROR, TAO_IIOP_Endpoint::object_addr(), TAO_Connector::orb_core(), TAO_IIOP_Endpoint::port(), TAO_Transport::purge_entry(), TAO_Wait_Strategy::register_handler(), TAO_Connect_Strategy::synch_options(), TAO_debug_level, ACE_Synch_Options::timeout(), TAO_Connection_Handler::transport(), TAO_Thread_Lane_Resources::transport_cache(), TAO_Connector::wait_for_connection_completion(), and TAO_Transport::wait_strategy().
00114 { 00115 TAO_IIOP_Endpoint *iiop_endpoint = 00116 dynamic_cast<TAO_IIOP_Endpoint *> (desc.endpoint ()); 00117 00118 if (iiop_endpoint == 0) 00119 return 0; 00120 00121 const ACE_INET_Addr &remote_address = 00122 iiop_endpoint->object_addr (); 00123 00124 if (TAO_debug_level > 4) 00125 ACE_DEBUG ((LM_DEBUG, 00126 ACE_TEXT ("(%P|%t) IIOP_SSL_Connector::connect ") 00127 ACE_TEXT ("making a new connection \n"))); 00128 00129 // Get the right synch options 00130 ACE_Synch_Options synch_options; 00131 00132 this->active_connect_strategy_->synch_options (max_wait_time, 00133 synch_options); 00134 00135 // If we don't need to block for a transport just set the timeout to 00136 // be zero. 00137 ACE_Time_Value tmp_zero (ACE_Time_Value::zero); 00138 if (!r->blocked_connect ()) 00139 { 00140 synch_options.timeout (ACE_Time_Value::zero); 00141 max_wait_time = &tmp_zero; 00142 } 00143 00144 00145 IIOP_SSL_Connection_Handler *svc_handler = 0; 00146 00147 // Connect. 00148 int result = 00149 this->base_connector_.connect (svc_handler, 00150 remote_address, 00151 synch_options); 00152 00153 // The connect() method creates the service handler and bumps the 00154 // #REFCOUNT# up one extra. There are three possibilities from 00155 // calling connect(): (a) connection succeeds immediately - in this 00156 // case, the #REFCOUNT# on the handler is two; (b) connection 00157 // completion is pending - in this case, the #REFCOUNT# on the 00158 // handler is also two; (c) connection fails immediately - in this 00159 // case, the #REFCOUNT# on the handler is one since close() gets 00160 // called on the handler. 00161 // 00162 // The extra reference count in 00163 // TAO_Connect_Creation_Strategy::make_svc_handler() is needed in 00164 // the case when connection completion is pending and we are going 00165 // to wait on a variable in the handler to changes, signifying 00166 // success or failure. Note, that this increment cannot be done 00167 // once the connect() returns since this might be too late if 00168 // another thread pick up the completion and potentially deletes the 00169 // handler before we get a chance to increment the reference count. 00170 00171 // Make sure that we always do a remove_reference 00172 ACE_Event_Handler_var svc_handler_auto_ptr (svc_handler); 00173 00174 TAO_Transport *transport = 00175 svc_handler->transport (); 00176 00177 if (result == -1) 00178 { 00179 // No immediate result, wait for completion 00180 if (errno == EWOULDBLOCK) 00181 { 00182 // Try to wait until connection completion. Incase we block, then we 00183 // get a connected transport or not. In case of non block we get 00184 // a connected or not connected transport 00185 if (!this->wait_for_connection_completion (r, 00186 transport, 00187 max_wait_time)) 00188 { 00189 if (TAO_debug_level > 2) 00190 ACE_ERROR ((LM_ERROR, "TAO (%P|%t) - IIOP_SSL_Connector::" 00191 "make_connection, " 00192 "wait for completion failed\n")); 00193 } 00194 } 00195 else 00196 { 00197 // Transport is not usable 00198 transport = 0; 00199 } 00200 } 00201 00202 // In case of errors transport is zero 00203 if (transport == 0) 00204 { 00205 // Give users a clue to the problem. 00206 if (TAO_debug_level) 00207 { 00208 ACE_DEBUG ((LM_ERROR, 00209 "TAO (%P|%t) - IIOP_SSL_Connector::make_connection, " 00210 "connection to <%s:%d> failed (%p)\n", 00211 iiop_endpoint->host (), iiop_endpoint->port (), 00212 "errno")); 00213 } 00214 00215 return 0; 00216 } 00217 00218 // At this point, the connection has be successfully connected. 00219 // #REFCOUNT# is one. 00220 if (TAO_debug_level > 2) 00221 ACE_DEBUG ((LM_DEBUG, 00222 "TAO (%P|%t) - IIOP_SSL_Connector::make_connection, " 00223 "new connection to <%s:%d> on Transport[%d]\n", 00224 iiop_endpoint->host (), iiop_endpoint->port (), 00225 svc_handler->peer ().get_handle ())); 00226 00227 // Add the handler to Cache 00228 int retval = 00229 this->orb_core ()->lane_resources ().transport_cache ().cache_transport ( 00230 &desc, 00231 transport); 00232 00233 // Failure in adding to cache. 00234 if (retval != 0) 00235 { 00236 // Close the handler. 00237 svc_handler->close (); 00238 00239 if (TAO_debug_level > 0) 00240 { 00241 ACE_ERROR ((LM_ERROR, 00242 "TAO (%P|%t) - IIOP_SSL_Connector::make_connection, " 00243 "could not add the new connection to cache\n")); 00244 } 00245 00246 return 0; 00247 } 00248 00249 if (transport->is_connected () && 00250 transport->wait_strategy ()->register_handler () != 0) 00251 { 00252 // Registration failures. 00253 00254 // Purge from the connection cache, if we are not in the cache, this 00255 // just does nothing. 00256 (void) transport->purge_entry (); 00257 00258 // Close the handler. 00259 (void) transport->close_connection (); 00260 00261 if (TAO_debug_level > 0) 00262 ACE_ERROR ((LM_ERROR, 00263 "TAO (%P|%t) - IIOP_SSL_Connector [%d]::make_connection, " 00264 "could not register the transport " 00265 "in the reactor.\n", 00266 transport->id ())); 00267 00268 return 0; 00269 } 00270 00271 return transport; 00272 } |
|
Reimplemented from TAO_IIOP_Connector. Reimplemented in TAO::SSLIOP::Connector. Definition at line 35 of file IIOP_SSL_Connector.cpp. References ACE_NEW_RETURN, CONNECT_CONCURRENCY_STRATEGY, CONNECT_CREATION_STRATEGY, TAO_Connector::create_connect_strategy(), ACE_Strategy_Connector< SVC_HANDLER, >::open(), TAO_Connector::orb_core(), and TAO_ORB_Core::thr_mgr(). Referenced by TAO::SSLIOP::Connector::open().
00036 { 00037 this->orb_core (orb_core); 00038 00039 // Create our connect strategy 00040 if (this->create_connect_strategy () == -1) 00041 return -1; 00042 00043 // Our connect creation strategy 00044 CONNECT_CREATION_STRATEGY *connect_creation_strategy = 0; 00045 00046 ACE_NEW_RETURN (connect_creation_strategy, 00047 CONNECT_CREATION_STRATEGY (orb_core->thr_mgr (), 00048 orb_core, 00049 this->lite_flag_), 00050 -1); 00051 00052 // Our activation strategy 00053 CONNECT_CONCURRENCY_STRATEGY *concurrency_strategy = 0; 00054 00055 ACE_NEW_RETURN (concurrency_strategy, 00056 CONNECT_CONCURRENCY_STRATEGY (orb_core), 00057 -1); 00058 00059 00060 return this->base_connector_.open (this->orb_core ()->reactor (), 00061 connect_creation_strategy, 00062 &this->connect_strategy_, 00063 concurrency_strategy); 00064 } |
|
Reimplemented from TAO_IIOP_Connector. Definition at line 75 of file IIOP_SSL_Connector.cpp. References ACE_DEBUG, ACE_TEXT(), ACE_Addr::get_type(), LM_DEBUG, TAO_IIOP_Endpoint::object_addr(), TAO_Endpoint::tag(), and TAO_debug_level.
00076 { 00077 if (endpoint->tag () != IOP::TAG_INTERNET_IOP) 00078 return -1; 00079 00080 TAO_IIOP_Endpoint *iiop_endpoint = 00081 dynamic_cast<TAO_IIOP_Endpoint *> (endpoint); 00082 00083 if (iiop_endpoint == 0) 00084 return -1; 00085 00086 const ACE_INET_Addr &remote_address = 00087 iiop_endpoint->object_addr (); 00088 00089 // Verify that the remote ACE_INET_Addr was initialized properly. 00090 // Failure can occur if hostname lookup failed when initializing the 00091 // remote ACE_INET_Addr. 00092 if (remote_address.get_type () != AF_INET) 00093 { 00094 if (TAO_debug_level > 0) 00095 { 00096 ACE_DEBUG ((LM_DEBUG, 00097 ACE_TEXT ("TAO (%P|%t) IIOP_SSL connection failed.\n") 00098 ACE_TEXT ("TAO (%P|%t) This is most likely ") 00099 ACE_TEXT ("due to a hostname lookup ") 00100 ACE_TEXT ("failure.\n"))); 00101 } 00102 00103 return -1; 00104 } 00105 00106 return 0; 00107 } |
|
The connector initiating connection requests for IIOP_SSL.
Reimplemented from TAO_IIOP_Connector. Reimplemented in TAO::SSLIOP::Connector. Definition at line 95 of file IIOP_SSL_Connector.h. |
|
Our connect strategy.
Reimplemented from TAO_IIOP_Connector. Reimplemented in TAO::SSLIOP::Connector. Definition at line 92 of file IIOP_SSL_Connector.h. |