summaryrefslogtreecommitdiff
path: root/TAO/tao/IIOP_Connector.cpp
diff options
context:
space:
mode:
authormarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-09-29 04:55:45 +0000
committermarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-09-29 04:55:45 +0000
commit0a729d1a2f2ab7baad78224eff45f182348be11e (patch)
treeccb8e4dc223d76aa5dec186d9e92edc4ec12c5ed /TAO/tao/IIOP_Connector.cpp
parentdda4f862d80e3fa88c3a0d819c030c609f2f4974 (diff)
downloadATCD-0a729d1a2f2ab7baad78224eff45f182348be11e.tar.gz
ChangeLogTag:Thu Sep 28 23:51:11 2000 Marina Spivak <marina@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/IIOP_Connector.cpp')
-rw-r--r--TAO/tao/IIOP_Connector.cpp97
1 files changed, 94 insertions, 3 deletions
diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp
index 6fa97b8f6ec..89e9ddd2917 100644
--- a/TAO/tao/IIOP_Connector.cpp
+++ b/TAO/tao/IIOP_Connector.cpp
@@ -8,6 +8,7 @@
#include "tao/Client_Strategy_Factory.h"
#include "tao/Environment.h"
#include "ace/Auto_Ptr.h"
+#include "tao/RT_Policy_i.h"
ACE_RCSID(tao, IIOP_Connector, "$Id$")
@@ -314,9 +315,11 @@ template class ACE_Refcounted_Recyclable_Handler_Caching_Utility<TAO_ADDR, TAO_C
TAO_IIOP_Connect_Creation_Strategy::
TAO_IIOP_Connect_Creation_Strategy (ACE_Thread_Manager* t,
TAO_ORB_Core *orb_core,
+ void *arg,
CORBA::Boolean flag)
: ACE_Creation_Strategy<TAO_IIOP_Client_Connection_Handler> (t),
orb_core_ (orb_core),
+ arg_ (arg),
lite_flag_ (flag)
{
}
@@ -330,7 +333,8 @@ TAO_IIOP_Connect_Creation_Strategy::make_svc_handler
TAO_IIOP_Client_Connection_Handler
(this->orb_core_->thr_mgr (),
this->orb_core_,
- this->lite_flag_),
+ this->lite_flag_,
+ this->arg_),
-1);
return 0;
}
@@ -352,8 +356,7 @@ TAO_IIOP_Connector::TAO_IIOP_Connector (CORBA::Boolean flag)
base_connector_ (),
lite_flag_ (flag)
#if defined (TAO_USES_ROBUST_CONNECTION_MGMT)
- ,
- cached_connect_strategy_ (0),
+ , cached_connect_strategy_ (0),
caching_strategy_ (0)
#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */
{
@@ -369,12 +372,16 @@ TAO_IIOP_Connector::open (TAO_ORB_Core *orb_core)
return -1;
#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */
+ if (this->init_tcp_properties () != 0)
+ return -1;
+
TAO_IIOP_Connect_Creation_Strategy *connect_creation_strategy = 0;
ACE_NEW_RETURN (connect_creation_strategy,
TAO_IIOP_Connect_Creation_Strategy
(this->orb_core_->thr_mgr (),
this->orb_core_,
+ &(this->tcp_properties_),
this->lite_flag_),
-1);
@@ -755,3 +762,87 @@ TAO_IIOP_Connector::object_key_delimiter (void) const
{
return TAO_IIOP_Profile::object_key_delimiter_;
}
+
+int
+TAO_IIOP_Connector::init_tcp_properties (void)
+{
+#if (TAO_HAS_RT_CORBA == 1)
+
+ // Connector protocol properties are obtained from ORB-level
+ // RTCORBA::ClientProtocolProperties policy override.
+ // If the override doesn't exist or doesn't contain the
+ // properties, we use ORB default.
+ //
+ // Currently, we do not use Object-level and Current-level policy
+ // overrides for protocol configuration because connection
+ // lookup and caching are not done based on protocol
+ // properties.
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ // Check ORB-level override for tcp properties.
+ TAO_ClientProtocolPolicy *client_protocols =
+ this->orb_core_->policy_manager ()->client_protocol ();
+ CORBA::Object_var auto_release = client_protocols;
+ RTCORBA::TCPProtocolProperties_var tcp_properties =
+ RTCORBA::TCPProtocolProperties::_nil ();
+
+ if (client_protocols != 0)
+ {
+ RTCORBA::ProtocolList & protocols = client_protocols->protocols_rep ();
+
+ for (CORBA::ULong j = 0; j < protocols.length (); ++j)
+ if (protocols[j].protocol_type == TAO_TAG_IIOP_PROFILE)
+ {
+ tcp_properties =
+ RTCORBA::TCPProtocolProperties::_narrow
+ (protocols[j].transport_protocol_properties.in (),
+ ACE_TRY_ENV);
+ ACE_CHECK_RETURN (-1);
+ break;
+ }
+ }
+
+ if (CORBA::is_nil (tcp_properties.in ()))
+ {
+ // No tcp properties in ORB-level override. Use ORB defaults.
+ // Orb defaults should never be null - they were initialized by
+ // the ORB_Core.
+ client_protocols = this->orb_core_->default_client_protocol ();
+ auto_release = client_protocols;
+ RTCORBA::ProtocolList & protocols = client_protocols->protocols_rep ();
+ for (CORBA::ULong j = 0; j < protocols.length (); ++j)
+ if (protocols[j].protocol_type == TAO_TAG_IIOP_PROFILE)
+ {
+ tcp_properties =
+ RTCORBA::TCPProtocolProperties::_narrow
+ (protocols[j].transport_protocol_properties.in (),
+ ACE_TRY_ENV);
+ ACE_CHECK_RETURN (-1);
+ break;
+ }
+ }
+
+ // Extract and locally store properties of interest.
+ this->tcp_properties_.send_buffer_size =
+ tcp_properties->send_buffer_size ();
+ this->tcp_properties_.recv_buffer_size =
+ tcp_properties->recv_buffer_size ();
+ this->tcp_properties_.no_delay =
+ tcp_properties->no_delay ();
+
+#else /* TAO_HAS_RT_CORBA == 1 */
+
+ // Without RTCORBA, protocol configuration properties come from ORB
+ // options.
+ this->tcp_properties_.send_buffer_size =
+ this->orb_core_->orb_params ()->sock_sndbuf_size ();
+ this->tcp_properties_.recv_buffer_size =
+ this->orb_core_->orb_params ()->sock_rcvbuf_size ();
+ this->tcp_properties_.no_delay =
+ this->orb_core_->orb_params ()->nodelay ();
+
+#endif /* TAO_HAS_RT_CORBA == 1 */
+
+ return 0;
+}