summaryrefslogtreecommitdiff
path: root/TAO/tao/IIOP_Acceptor.cpp
diff options
context:
space:
mode:
authormarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-08-26 19:11:05 +0000
committermarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-08-26 19:11:05 +0000
commitdc5afda7c5f82b719b155bc2a363a64d8cfbc771 (patch)
tree5f71280b91de516842b6288149ef5eb2066d2f69 /TAO/tao/IIOP_Acceptor.cpp
parent95df88639321e617de9e376b19a018ff7eff5ed7 (diff)
downloadATCD-dc5afda7c5f82b719b155bc2a363a64d8cfbc771.tar.gz
ChangeLogTag:Sat Aug 26 13:06:23 2000 Marina Spivak <marina@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/IIOP_Acceptor.cpp')
-rw-r--r--TAO/tao/IIOP_Acceptor.cpp107
1 files changed, 105 insertions, 2 deletions
diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp
index 19d0973be17..c72f78d897f 100644
--- a/TAO/tao/IIOP_Acceptor.cpp
+++ b/TAO/tao/IIOP_Acceptor.cpp
@@ -7,6 +7,7 @@
#include "tao/ORB_Core.h"
#include "tao/Server_Strategy_Factory.h"
#include "tao/debug.h"
+#include "tao/RT_Policy_i.h"
#include "ace/Auto_Ptr.h"
@@ -155,6 +156,11 @@ TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core,
const char *address,
const char *options)
{
+ this->orb_core_ = orb_core;
+
+ if (this->init_tcp_properties () != 0)
+ return -1;
+
if (this->hosts_ != 0)
{
// The hostname cache has already been set!
@@ -243,6 +249,11 @@ TAO_IIOP_Acceptor::open_default (TAO_ORB_Core *orb_core,
int minor,
const char *options)
{
+ this->orb_core_ = orb_core;
+
+ if (this->init_tcp_properties () != 0)
+ return -1;
+
if (this->hosts_ != 0)
{
// The hostname cache has already been set!
@@ -286,10 +297,9 @@ int
TAO_IIOP_Acceptor::open_i (TAO_ORB_Core* orb_core,
const ACE_INET_Addr& addr)
{
- this->orb_core_ = orb_core;
-
ACE_NEW_RETURN (this->creation_strategy_,
TAO_IIOP_CREATION_STRATEGY (this->orb_core_,
+ &(this->tcp_properties_),
this->lite_flag_),
-1);
@@ -638,3 +648,96 @@ TAO_IIOP_Acceptor::parse_options (const char *str)
}
return 0;
}
+
+int
+TAO_IIOP_Acceptor::init_tcp_properties (void)
+{
+#if (TAO_HAS_RT_CORBA == 1)
+
+ // @@ Currently (in the code below), we obtain protocol properties from
+ // ORB-level ServerProtocol, even though the policy may
+ // have been overridden on POA level. That's because currently all
+ // endpoints (acceptors) are global. Once endpoints become per POA,
+ // the code below will have to be changed to look at the POA-level
+ // ServerProtocol policy first.
+
+ // @@ Later we may want to factor some of the code below
+ // among different protocols and place it into TAO_Acceptor, for
+ // example.
+
+ // ServerProtocolProperties policy controls protocols configuration.
+ // Look for protocol properties in the effective ServerProtocolPolicy.
+ TAO_ServerProtocolPolicy *server_protocols =
+ this->orb_core_->server_protocol ();
+ // Automatically release the policy.
+ CORBA::Object_var auto_release = server_protocols;
+ RTCORBA::TCPProtocolProperties_var tcp_properties =
+ RTCORBA::TCPProtocolProperties::_nil ();
+ RTCORBA::ProtocolList & protocols = server_protocols->protocols_rep ();
+
+ // Find protocol properties for TCP.
+ ACE_DECLARE_NEW_CORBA_ENV;
+ 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 ()))
+ {
+ // TCP Properties were not specified in the effective policy.
+ // We must use orb defaults.
+
+ server_protocols = this->orb_core_->default_server_protocol ();
+ // Automatically release the policy.
+ auto_release = server_protocols;
+ // Find protocol properties for IIOP.
+ RTCORBA::ProtocolList & protocols = server_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;
+ }
+
+ // Orb defaults should never be null, since the ORB initializes
+ // them in ORB_init ...
+ }
+
+ // 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 ();
+
+ // @@ NOTE. RTCORBA treats a combination of transport+messaging
+ // as a single protocol. Keep this in mind for when we adopt
+ // RTCORBA approach to protocols configuration for nonRT use. In
+ // particular, what are the semantics of independent variation of
+ // messaging and transport layers, when one transport appears in
+ // combination with several messaging protocols, for example.
+
+#else /* TAO_HAS_RT_CORBA == 1 */
+
+ 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;
+}