summaryrefslogtreecommitdiff
path: root/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2002-08-16 17:02:24 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2002-08-16 17:02:24 +0000
commitb2336fb0d235ba466ab74fc12a0fe4d465cf49da (patch)
tree432d72353d933e238373287ac00bdf0d74ff2b52 /TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
parentcc545f7f2b771f6337cd305f50c0d96657fa52a0 (diff)
downloadATCD-b2336fb0d235ba466ab74fc12a0fe4d465cf49da.tar.gz
ChangeLogTag:Fri Aug 16 09:43:03 2002 Ossama Othman <ossama@uci.edu>
Diffstat (limited to 'TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp')
-rw-r--r--TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp143
1 files changed, 70 insertions, 73 deletions
diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
index 6daee4c4192..7332454b776 100644
--- a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
+++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp
@@ -8,7 +8,6 @@
#include "tao/Acceptor_Registry.h"
#include "tao/Thread_Lane_Resources.h"
#include "tao/Protocol_Factory.h"
-//#include "tao/Pluggable.h"
#include "tao/Transport_Acceptor.h"
#include "tao/Transport_Connector.h"
#include "Priority_Mapping_Manager.h"
@@ -17,20 +16,19 @@
#include "ace/Dynamic_Service.h"
-ACE_RCSID (TAO,
+
+ACE_RCSID (RTCORBA,
RT_Protocols_Hooks,
"$Id$")
- TAO_RT_Protocols_Hooks::Client_Protocols_Hook TAO_RT_Protocols_Hooks::client_protocols_hook_ = 0;
+TAO_RT_Protocols_Hooks::Client_Protocols_Hook TAO_RT_Protocols_Hooks::client_protocols_hook_ = 0;
TAO_RT_Protocols_Hooks::Server_Protocols_Hook TAO_RT_Protocols_Hooks::server_protocols_hook_ = 0;
-/// constructor
TAO_RT_Protocols_Hooks::TAO_RT_Protocols_Hooks (void)
{
}
-/// destructor
TAO_RT_Protocols_Hooks::~TAO_RT_Protocols_Hooks (void)
{
}
@@ -40,7 +38,7 @@ TAO_RT_Protocols_Hooks::init_hooks (TAO_ORB_Core *orb_core
ACE_ENV_ARG_DECL)
{
this->orb_core_ = orb_core;
-
+
// Save a reference to the priority mapping manager.
CORBA::Object_var obj =
orb_core->object_ref_table ().resolve_initial_references (TAO_OBJID_PRIORITYMAPPINGMANAGER
@@ -57,12 +55,12 @@ TAO_RT_Protocols_Hooks::init_hooks (TAO_ORB_Core *orb_core
orb_core->object_ref_table ().resolve_initial_references (TAO_OBJID_NETWORKPRIORITYMAPPINGMANAGER
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
-
+
this->network_mapping_manager_ =
TAO_Network_Priority_Mapping_Manager::_narrow (object.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
-
+
}
int
@@ -123,7 +121,7 @@ TAO_RT_Protocols_Hooks::set_server_protocols_hook (Server_Protocols_Hook hook)
// Saving the hook pointer so that we can use it later when needed.
}
-int
+int
TAO_RT_Protocols_Hooks::update_client_protocol_properties (TAO_Stub *stub,
TAO_Connection_Handler *connection_handler,
const char *protocol_type)
@@ -139,29 +137,29 @@ TAO_RT_Protocols_Hooks::update_client_protocol_properties (TAO_Stub *stub,
TAO_RT_Stub *rt_stub = ACE_dynamic_cast (TAO_RT_Stub *,
stub);
-
+
CORBA::Policy* policy = rt_stub->client_protocol ();
-
+
RTCORBA::ClientProtocolPolicy_var client_protocols_policy;
TAO_ClientProtocolPolicy *client_protocols = 0;
-
+
if (!CORBA::is_nil (policy))
{
client_protocols_policy =
RTCORBA::ClientProtocolPolicy::_narrow (policy
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
client_protocols =
ACE_dynamic_cast (TAO_ClientProtocolPolicy *,
client_protocols_policy.in ());
-
+
if (client_protocols != 0)
{
//TAO_ClientProtocolPolicy
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)
@@ -171,22 +169,22 @@ TAO_RT_Protocols_Hooks::update_client_protocol_properties (TAO_Stub *stub,
protocols[j].transport_protocol_properties.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
if (ACE_OS::strcmp (protocol_type, "iiop") == 0)
break;
}
}
}
-
+
if (ACE_OS::strcmp (protocol_type, "iiop") == 0)
{
- if (!CORBA::is_nil (properties.in ()))
+ if (!CORBA::is_nil (properties.in ()))
{
RTCORBA::TCPProtocolProperties_var tcp_properties =
RTCORBA::TCPProtocolProperties::_narrow (properties.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
int send_buffer_size =
tcp_properties->send_buffer_size (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
@@ -210,13 +208,13 @@ TAO_RT_Protocols_Hooks::update_client_protocol_properties (TAO_Stub *stub,
}
}
}
- }
+ }
ACE_CATCHANY
{
if (TAO_debug_level > 4)
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"TAO_RT_Protocols_Hooks::get_effective_client_protocol_properties");
-
+
return -1;
}
ACE_ENDTRY;
@@ -224,41 +222,41 @@ TAO_RT_Protocols_Hooks::update_client_protocol_properties (TAO_Stub *stub,
return 0;
}
-int
+int
TAO_RT_Protocols_Hooks::update_server_protocol_properties (CORBA::Policy *policy,
TAO_Connection_Handler *connection_handler,
const char *protocol_type)
{
-
+
if (TAO_debug_level)
ACE_DEBUG ((LM_DEBUG,
"TAO_RT_Protocols_Hooks::get_effective_server_protocol_properties\n"));
-
+
ACE_TRY_NEW_ENV
{
RTCORBA::ProtocolProperties_var properties =
RTCORBA::ProtocolProperties::_nil ();
-
+
RTCORBA::ServerProtocolPolicy_var server_protocols_policy;
TAO_ServerProtocolPolicy *server_protocols = 0;
-
+
if (!CORBA::is_nil (policy))
{
server_protocols_policy =
RTCORBA::ServerProtocolPolicy::_narrow (policy
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
server_protocols =
ACE_dynamic_cast (TAO_ServerProtocolPolicy *,
server_protocols_policy.in ());
-
+
if (server_protocols != 0)
{
//TAO_ServerProtocolPolicy
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)
@@ -268,22 +266,22 @@ TAO_RT_Protocols_Hooks::update_server_protocol_properties (CORBA::Policy *policy
protocols[j].transport_protocol_properties.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
if (ACE_OS::strcmp (protocol_type, "iiop") == 0)
break;
}
}
}
-
+
if (ACE_OS::strcmp (protocol_type, "iiop") == 0)
{
- if (!CORBA::is_nil (properties.in ()))
+ if (!CORBA::is_nil (properties.in ()))
{
RTCORBA::TCPProtocolProperties_var tcp_properties =
RTCORBA::TCPProtocolProperties::_narrow (properties.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
int send_buffer_size =
tcp_properties->send_buffer_size (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
@@ -300,24 +298,24 @@ TAO_RT_Protocols_Hooks::update_server_protocol_properties (CORBA::Policy *policy
ACE_dynamic_cast (TAO_IIOP_Connection_Handler *,
connection_handler);
- iiop_handler->update_protocol_properties (send_buffer_size,
- recv_buffer_size,
+ iiop_handler->update_protocol_properties (send_buffer_size,
+ recv_buffer_size,
no_delay,
enable_network_priority);
}
}
}
- }
+ }
ACE_CATCHANY
{
if (TAO_debug_level > 4)
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"TAO_RT_Protocols_Hooks::get_effective_client_protocol_properties");
-
+
return -1;
}
ACE_ENDTRY;
-
+
return 0;
}
@@ -328,44 +326,58 @@ TAO_RT_Protocols_Hooks::get_dscp_codepoint (void)
ACE_DEBUG ((LM_DEBUG,
"TAO_RT_Protocols_Hooks::get_dscp_codepoint\n"));
- ACE_TRY_NEW_ENV
+ CORBA::Long codepoint = 0;
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
{
-
// Make several invocation, changing the priority of this thread
// for each.
CORBA::Object_var object =
- this->orb_core_->object_ref_table ().resolve_initial_references ("RTCurrent" ACE_ENV_ARG_PARAMETER);
+ this->orb_core_->object_ref_table ().resolve_initial_references (
+ "RTCurrent"
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
RTCORBA::Current_var current =
- RTCORBA::Current::_narrow (object.in () ACE_ENV_ARG_PARAMETER);
+ RTCORBA::Current::_narrow (object.in ()
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
RTCORBA::NetworkPriorityMapping *pm =
this->network_mapping_manager_->mapping ();
-
- CORBA::Long codepoint = 0;
-
- CORBA::Short priority =
+
+ CORBA::Short priority =
current->the_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
-
+
if (pm->to_network (priority, codepoint) == 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Cannot convert corba priority %d to network priority\n",
- priority),
- -1);
- return codepoint;
-
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "Cannot convert corba priority %d "
+ "to network priority\n",
+ priority));
+ }
+
+ return -1;
+ }
}
ACE_CATCHANY
{
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Caught exception:");
+ if (TAO_debug_level > 0)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "TAO_RT_Protocols_Hooks::get_dscp_codepoint");
+ }
+
return -1;
}
ACE_ENDTRY;
- return 0;
+ ACE_CHECK_RETURN (-1);
+
+ return codepoint;
}
void
@@ -725,18 +737,3 @@ ACE_STATIC_SVC_DEFINE (TAO_RT_Protocols_Hooks,
#pragma instantiate ACE_Dynamic_Service<TAO_RT_Protocols_Hooks>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-