diff options
author | bala <balanatarajan@users.noreply.github.com> | 2002-04-16 12:29:12 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2002-04-16 12:29:12 +0000 |
commit | 129a0327317212be28041fc496a2c3ec4646363a (patch) | |
tree | e152da6f29d06e6c2178654e6a6c7be135f95aef | |
parent | c233f0b284afde570ef686c2e84159edcaa29b32 (diff) | |
download | ATCD-129a0327317212be28041fc496a2c3ec4646363a.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/tao/ChangeLog | 5 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connector.cpp | 112 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connector.h | 32 |
3 files changed, 81 insertions, 68 deletions
diff --git a/TAO/tao/ChangeLog b/TAO/tao/ChangeLog new file mode 100644 index 00000000000..4f1257e8d1c --- /dev/null +++ b/TAO/tao/ChangeLog @@ -0,0 +1,5 @@ +Tue Apr 16 07:43:44 2002 Balachandran Natarajan <bala@cs.wustl.edu> + + * IIOP_Connector.h: Added a new mthod narrow_endpoint () + * IIOP_Connector.cpp: + diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index d4a40dd7424..97a7338c7bf 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -103,72 +103,40 @@ int TAO_IIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, TAO_Transport_Descriptor_Interface *desc) { - ACE_Time_Value *max_wait_time = invocation->max_wait_time (); - TAO_Endpoint *endpoint = desc->endpoint (); + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) IIOP_Connector::connect - ") + ACE_LIB_TEXT ("making a new connection\n"))); - if (endpoint->tag () != TAO_TAG_IIOP_PROFILE) - return -1; - - TAO_IIOP_Endpoint *iiop_endpoint = - ACE_dynamic_cast (TAO_IIOP_Endpoint *, - endpoint ); - if (iiop_endpoint == 0) - return -1; - const ACE_INET_Addr &remote_address = - iiop_endpoint->object_addr (); - // Verify that the remote ACE_INET_Addr was initialized properly. - // Failure can occur if hostname lookup failed when initializing the - // remote ACE_INET_Addr. - if (remote_address.get_type () != AF_INET) - { - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("TAO (%P|%t) IIOP connection failed.\n") - ACE_LIB_TEXT ("TAO (%P|%t) This is most likely ") - ACE_LIB_TEXT ("due to a hostname lookup ") - ACE_LIB_TEXT ("failure.\n"))); - } + TAO_IIOP_Endpoint *iiop_endpoint = + this->narrow_endpoint (desc->endpoint ()); - return -1; - } + if (iiop_endpoint == 0) + return -1; int result = 0; - TAO_IIOP_Connection_Handler *svc_handler = 0; - - if (TAO_debug_level > 2) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("(%P|%t) IIOP_Connector::connect - ") - ACE_LIB_TEXT ("making a new connection\n"))); + TAO_IIOP_Connection_Handler *svc_handler = 0; // Purge connections (if necessary) // @@TODO: This is not the right place for this! this->orb_core ()->lane_resources ().transport_cache ().purge (); - // @@todo: Need to add code for non-blocking connects.. - if (max_wait_time != 0) - { - ACE_Synch_Options synch_options (ACE_Synch_Options::USE_TIMEOUT, - *max_wait_time); - - // We obtain the transport in the <svc_handler> variable. As - // we know now that the connection is not available in Cache - // we can make a new connection - result = this->base_connector_.connect (svc_handler, - remote_address, - synch_options); - } - else - { - // We obtain the transport in the <svc_handler> variable. As - // we know now that the connection is not available in Cache - // we can make a new connection - result = this->base_connector_.connect (svc_handler, - remote_address); - } + ACE_Time_Value *max_wait_time = + invocation->max_wait_time (); + + /////////////**************** + ACE_Synch_Options synch_options (ACE_Synch_Options::USE_REACTOR, + *max_wait_time); + + // We obtain the transport in the <svc_handler> variable. As + // we know now that the connection is not available in Cache + // we can make a new connection + result = this->base_connector_.connect (svc_handler, + remote_address, + synch_options); if (result == -1) { @@ -351,6 +319,42 @@ TAO_IIOP_Connector::init_tcp_properties (void) return 0; } +TAO_IIOP_Endpoint * +TAO_IIOP_Connector::narrow_endpoint (TAO_Endpoint *endpoint) +{ + if (endpoint->tag () != TAO_TAG_IIOP_PROFILE) + return -1; + + TAO_IIOP_Endpoint *iiop_endpoint = + ACE_dynamic_cast (TAO_IIOP_Endpoint *, + endpoint ); + + if (iiop_endpoint == 0) + return 0; + + const ACE_INET_Addr &remote_address = + iiop_endpoint->object_addr (); + + // Verify that the remote ACE_INET_Addr was initialized properly. + // Failure can occur if hostname lookup failed when initializing the + // remote ACE_INET_Addr. + if (remote_address.get_type () != AF_INET) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("TAO (%P|%t) IIOP connection failed.\n") + ACE_LIB_TEXT ("TAO (%P|%t) This is most likely ") + ACE_LIB_TEXT ("due to a hostname lookup ") + ACE_LIB_TEXT ("failure.\n"))); + } + + return 0; + } + + return iiop_endpoint; +} + #if 0 /** diff --git a/TAO/tao/IIOP_Connector.h b/TAO/tao/IIOP_Connector.h index ffc5c8f119b..1f22fbadf22 100644 --- a/TAO/tao/IIOP_Connector.h +++ b/TAO/tao/IIOP_Connector.h @@ -62,20 +62,6 @@ public: virtual char object_key_delimiter (void) const; -protected: - // = The TAO_Connector methods, please check the documentation on - // Transport_Connector.h - int make_connection (TAO_GIOP_Invocation *invocation, - TAO_Transport_Descriptor_Interface *desc); - - /// More TAO_Connector methods, please check the documentation on - /// Transport_Connector.h - virtual TAO_Profile *make_profile (ACE_ENV_SINGLE_ARG_DECL); - - /// Obtain tcp properties that must be used by this connector, i.e., - /// initialize <tcp_properties_>. - int init_tcp_properties (void); - public: typedef TAO_Connect_Concurrency_Strategy<TAO_IIOP_Connection_Handler> @@ -94,6 +80,24 @@ public: protected: + // = The TAO_Connector methods, please check the documentation on + // Transport_Connector.h + int make_connection (TAO_GIOP_Invocation *invocation, + TAO_Transport_Descriptor_Interface *desc); + + /// More TAO_Connector methods, please check the documentation on + /// Transport_Connector.h + virtual TAO_Profile *make_profile (ACE_ENV_SINGLE_ARG_DECL); + + /// Obtain tcp properties that must be used by this connector, i.e., + /// initialize <tcp_properties_>. + int init_tcp_properties (void); + + /// Narrow the <endpoint> to an IIOP_Endpoint + TAO_IIOP_Endpoint *narrow_endpoint (TAO_Endpoint *); + +protected: + /// TCP configuration properties to be used for all /// connections established by this connector. TAO_IIOP_Properties tcp_properties_; |