diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-08-29 13:26:59 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-08-29 13:26:59 +0000 |
commit | 19d98fa2e1b9930b7dba43fc4665d260a7c2efa8 (patch) | |
tree | a8c1f207169908a443410ec8c20df2952537e630 | |
parent | d32aa2a0171bb470da075867980fcaff6513a27c (diff) | |
download | ATCD-19d98fa2e1b9930b7dba43fc4665d260a7c2efa8.tar.gz |
ChangeLogTag: Fri Aug 29 08:24:17 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 7 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp | 326 |
2 files changed, 222 insertions, 111 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 5de95cc0c02..8ab3e799138 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,10 @@ +Fri Aug 29 08:24:17 2003 Jeff Parsons <j.parsons@vanderbilt.edu> + + * tao/RTCORBA/RT_Protocols_Hooks.cpp: + + Added #include of tao/debug.h and made cosmetic changes to + keep line lengths under 80 columns. + Fri Aug 29 07:45:30 2003 Jeff Parsons <j.parsons@vanderbilt.edu> * tao/PollableC.cpp: diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp index 060f2a4817a..4a4f2ac15e4 100644 --- a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp +++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp @@ -17,6 +17,7 @@ #include "tao/Transport_Connector.h" #include "tao/Policy_Set.h" #include "tao/IIOP_Transport.h" +#include "tao/debug.h" #include "ace/Dynamic_Service.h" @@ -26,8 +27,10 @@ ACE_RCSID (RTCORBA, "$Id$") -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; +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; TAO_RT_Protocols_Hooks::TAO_RT_Protocols_Hooks (void) { @@ -45,8 +48,10 @@ TAO_RT_Protocols_Hooks::init_hooks (TAO_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 - ACE_ENV_ARG_PARAMETER); + orb_core->object_ref_table ().resolve_initial_references ( + TAO_OBJID_PRIORITYMAPPINGMANAGER + ACE_ENV_ARG_PARAMETER + ); ACE_CHECK; this->mapping_manager_ = @@ -56,8 +61,10 @@ TAO_RT_Protocols_Hooks::init_hooks (TAO_ORB_Core *orb_core // Save a reference to the priority mapping manager. CORBA::Object_var object = - orb_core->object_ref_table ().resolve_initial_references (TAO_OBJID_NETWORKPRIORITYMAPPINGMANAGER - ACE_ENV_ARG_PARAMETER); + orb_core->object_ref_table ().resolve_initial_references ( + TAO_OBJID_NETWORKPRIORITYMAPPINGMANAGER + ACE_ENV_ARG_PARAMETER + ); ACE_CHECK; this->network_mapping_manager_ = @@ -67,8 +74,9 @@ TAO_RT_Protocols_Hooks::init_hooks (TAO_ORB_Core *orb_core object = this->orb_core_->object_ref_table ().resolve_initial_references ( - "RTCurrent" - ACE_ENV_ARG_PARAMETER); + "RTCurrent" + ACE_ENV_ARG_PARAMETER + ); ACE_CHECK; this->current_ = @@ -79,11 +87,13 @@ TAO_RT_Protocols_Hooks::init_hooks (TAO_ORB_Core *orb_core } int -TAO_RT_Protocols_Hooks::call_client_protocols_hook (int &send_buffer_size, - int &recv_buffer_size, - int &no_delay, - int &enable_network_priority, - const char *protocol_type) +TAO_RT_Protocols_Hooks::call_client_protocols_hook ( + int &send_buffer_size, + int &recv_buffer_size, + int &no_delay, + int &enable_network_priority, + const char *protocol_type + ) { if (TAO_RT_Protocols_Hooks::client_protocols_hook_ == 0) return -1; @@ -106,14 +116,18 @@ TAO_RT_Protocols_Hooks::set_client_protocols_hook (Client_Protocols_Hook hook) } int -TAO_RT_Protocols_Hooks::call_server_protocols_hook (int &send_buffer_size, - int &recv_buffer_size, - int &no_delay, - int &enable_network_priority, - const char *protocol_type) +TAO_RT_Protocols_Hooks::call_server_protocols_hook ( + int &send_buffer_size, + int &recv_buffer_size, + int &no_delay, + int &enable_network_priority, + const char *protocol_type + ) { if (TAO_RT_Protocols_Hooks::server_protocols_hook_ == 0) - return -1; + { + return -1; + } int result_value = (*TAO_RT_Protocols_Hooks::server_protocols_hook_) (this->orb_core_, @@ -124,7 +138,9 @@ TAO_RT_Protocols_Hooks::call_server_protocols_hook (int &send_buffer_size, protocol_type); if (result_value != 0) - return -1; + { + return -1; + } return 0; } @@ -137,13 +153,16 @@ TAO_RT_Protocols_Hooks::set_server_protocols_hook (Server_Protocols_Hook hook) } int -TAO_RT_Protocols_Hooks::update_client_protocol_properties (TAO_Stub *stub, - TAO_Transport *transport, - const char *protocol_type) +TAO_RT_Protocols_Hooks::update_client_protocol_properties ( + TAO_Stub *stub, + TAO_Transport *transport, + const char *protocol_type + ) { if (TAO_debug_level) ACE_DEBUG ((LM_DEBUG, - "TAO_RT_Protocols_Hooks::get_effective_client_protocol_properties\n")); + "TAO_RT_Protocols_Hooks::" + "get_effective_client_protocol_properties\n")); ACE_TRY_NEW_ENV { @@ -181,12 +200,15 @@ TAO_RT_Protocols_Hooks::update_client_protocol_properties (TAO_Stub *stub, { properties = RTCORBA::ProtocolProperties::_narrow ( - protocols[j].transport_protocol_properties.in () - ACE_ENV_ARG_PARAMETER); + protocols[j].transport_protocol_properties.in () + ACE_ENV_ARG_PARAMETER + ); ACE_TRY_CHECK; if (ACE_OS::strcmp (protocol_type, "iiop") == 0) - break; + { + break; + } } } } @@ -196,30 +218,46 @@ TAO_RT_Protocols_Hooks::update_client_protocol_properties (TAO_Stub *stub, if (!CORBA::is_nil (properties.in ())) { RTCORBA::TCPProtocolProperties_var tcp_properties = - RTCORBA::TCPProtocolProperties::_narrow (properties.in () - ACE_ENV_ARG_PARAMETER); + 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); + tcp_properties->send_buffer_size ( + ACE_ENV_SINGLE_ARG_PARAMETER + ); ACE_TRY_CHECK; + int recv_buffer_size = - tcp_properties->recv_buffer_size (ACE_ENV_SINGLE_ARG_PARAMETER); + tcp_properties->recv_buffer_size ( + ACE_ENV_SINGLE_ARG_PARAMETER + ); ACE_TRY_CHECK; - int no_delay = tcp_properties->no_delay (ACE_ENV_SINGLE_ARG_PARAMETER); + + int no_delay = + tcp_properties->no_delay ( + ACE_ENV_SINGLE_ARG_PARAMETER + ); ACE_TRY_CHECK; + int enable_network_priority = - tcp_properties->enable_network_priority (ACE_ENV_SINGLE_ARG_PARAMETER); + tcp_properties->enable_network_priority ( + ACE_ENV_SINGLE_ARG_PARAMETER + ); ACE_TRY_CHECK; TAO_IIOP_Transport *iiop_transport = ACE_dynamic_cast (TAO_IIOP_Transport *, transport); - iiop_transport->update_protocol_properties (send_buffer_size, - recv_buffer_size, - no_delay, - enable_network_priority); + iiop_transport->update_protocol_properties ( + send_buffer_size, + recv_buffer_size, + no_delay, + enable_network_priority + ); } } } @@ -228,7 +266,8 @@ TAO_RT_Protocols_Hooks::update_client_protocol_properties (TAO_Stub *stub, { if (TAO_debug_level > 4) ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "TAO_RT_Protocols_Hooks::get_effective_client_protocol_properties"); + "TAO_RT_Protocols_Hooks::" + "get_effective_client_protocol_properties"); return -1; } @@ -238,14 +277,17 @@ TAO_RT_Protocols_Hooks::update_client_protocol_properties (TAO_Stub *stub, } int -TAO_RT_Protocols_Hooks::update_server_protocol_properties (CORBA::Policy *policy, - TAO_Transport *transport, - const char *protocol_type) +TAO_RT_Protocols_Hooks::update_server_protocol_properties ( + CORBA::Policy *policy, + TAO_Transport *transport, + const char *protocol_type + ) { if (TAO_debug_level) ACE_DEBUG ((LM_DEBUG, - "TAO_RT_Protocols_Hooks::get_effective_server_protocol_properties\n")); + "TAO_RT_Protocols_Hooks::" + "get_effective_server_protocol_properties\n")); ACE_TRY_NEW_ENV { @@ -283,7 +325,9 @@ TAO_RT_Protocols_Hooks::update_server_protocol_properties (CORBA::Policy *policy ACE_TRY_CHECK; if (ACE_OS::strcmp (protocol_type, "iiop") == 0) - break; + { + break; + } } } } @@ -293,30 +337,46 @@ TAO_RT_Protocols_Hooks::update_server_protocol_properties (CORBA::Policy *policy if (!CORBA::is_nil (properties.in ())) { RTCORBA::TCPProtocolProperties_var tcp_properties = - RTCORBA::TCPProtocolProperties::_narrow (properties.in () - ACE_ENV_ARG_PARAMETER); + 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); + tcp_properties->send_buffer_size ( + ACE_ENV_SINGLE_ARG_PARAMETER + ); ACE_TRY_CHECK; + int recv_buffer_size = - tcp_properties->recv_buffer_size (ACE_ENV_SINGLE_ARG_PARAMETER); + tcp_properties->recv_buffer_size ( + ACE_ENV_SINGLE_ARG_PARAMETER + ); ACE_TRY_CHECK; - int no_delay = tcp_properties->no_delay (ACE_ENV_SINGLE_ARG_PARAMETER); + + int no_delay = + tcp_properties->no_delay ( + ACE_ENV_SINGLE_ARG_PARAMETER + ); ACE_TRY_CHECK; + int enable_network_priority = - tcp_properties->enable_network_priority (ACE_ENV_SINGLE_ARG_PARAMETER); + tcp_properties->enable_network_priority ( + ACE_ENV_SINGLE_ARG_PARAMETER + ); ACE_TRY_CHECK; TAO_IIOP_Transport *iiop_transport = ACE_dynamic_cast (TAO_IIOP_Transport *, transport); - iiop_transport->update_protocol_properties (send_buffer_size, - recv_buffer_size, - no_delay, - enable_network_priority); + iiop_transport->update_protocol_properties ( + send_buffer_size, + recv_buffer_size, + no_delay, + enable_network_priority + ); } } } @@ -325,7 +385,8 @@ TAO_RT_Protocols_Hooks::update_server_protocol_properties (CORBA::Policy *policy { if (TAO_debug_level > 4) ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "TAO_RT_Protocols_Hooks::get_effective_client_protocol_properties"); + "TAO_RT_Protocols_Hooks::" + "get_effective_client_protocol_properties"); return -1; } @@ -386,10 +447,12 @@ TAO_RT_Protocols_Hooks::get_dscp_codepoint (void) } void -TAO_RT_Protocols_Hooks::rt_service_context (TAO_Stub *stub, - TAO_Service_Context &service_context, - CORBA::Boolean restart - ACE_ENV_ARG_DECL) +TAO_RT_Protocols_Hooks::rt_service_context ( + TAO_Stub *stub, + TAO_Service_Context &service_context, + CORBA::Boolean restart + ACE_ENV_ARG_DECL + ) { // If the restart flag is true, then this call for a // reinvocation. We need not prepare the Service Context List once @@ -409,8 +472,9 @@ TAO_RT_Protocols_Hooks::rt_service_context (TAO_Stub *stub, ACE_CHECK; CORBA::Short client_priority; - int status = this->get_thread_CORBA_priority (client_priority - ACE_ENV_ARG_PARAMETER); + int status = + this->get_thread_CORBA_priority (client_priority + ACE_ENV_ARG_PARAMETER); if (status == -1) ACE_THROW (CORBA::DATA_CONVERSION (1, CORBA::COMPLETED_NO)); @@ -430,10 +494,12 @@ TAO_RT_Protocols_Hooks::rt_service_context (TAO_Stub *stub, } void -TAO_RT_Protocols_Hooks::add_rt_service_context_hook (TAO_Service_Context &service_context, - CORBA::Policy *model_policy, - CORBA::Short &client_priority - ACE_ENV_ARG_DECL) +TAO_RT_Protocols_Hooks::add_rt_service_context_hook ( + TAO_Service_Context &service_context, + CORBA::Policy *model_policy, + CORBA::Short &client_priority + ACE_ENV_ARG_DECL + ) { RTCORBA::PriorityModelPolicy_var model_policy_ptr = @@ -450,20 +516,22 @@ TAO_RT_Protocols_Hooks::add_rt_service_context_hook (TAO_Service_Context &servic // Encapsulate the priority of the current thread into // a service context. TAO_OutputCDR cdr; - if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) - == 0) - || (cdr << client_priority) - == 0) - ACE_THROW (CORBA::MARSHAL ()); + if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER) == 0) + || (cdr << client_priority) == 0) + { + ACE_THROW (CORBA::MARSHAL ()); + } service_context.set_context (IOP::RTCorbaPriority, cdr); } } void -TAO_RT_Protocols_Hooks::get_selector_hook (CORBA::Policy *model_policy, - CORBA::Boolean &is_client_propagated, - CORBA::Short &server_priority) +TAO_RT_Protocols_Hooks::get_selector_hook ( + CORBA::Policy *model_policy, + CORBA::Boolean &is_client_propagated, + CORBA::Short &server_priority + ) { RTCORBA::PriorityModelPolicy_var model_policy_ptr = @@ -474,21 +542,27 @@ TAO_RT_Protocols_Hooks::get_selector_hook (CORBA::Policy *model_policy, model_policy_ptr.in ()); if (priority_model_policy->get_priority_model () - == RTCORBA::CLIENT_PROPAGATED) - is_client_propagated = 1; + == RTCORBA::CLIENT_PROPAGATED) + { + is_client_propagated = 1; + } if (!is_client_propagated) - server_priority = priority_model_policy->server_priority (); + { + server_priority = priority_model_policy->server_priority (); + } return; } void -TAO_RT_Protocols_Hooks::get_selector_bands_policy_hook (CORBA::Policy *bands_policy, - CORBA::Short priority, - CORBA::Short &min_priority, - CORBA::Short &max_priority, - int &in_range) +TAO_RT_Protocols_Hooks::get_selector_bands_policy_hook ( + CORBA::Policy *bands_policy, + CORBA::Short priority, + CORBA::Short &min_priority, + CORBA::Short &max_priority, + int &in_range + ) { RTCORBA::PriorityBandedConnectionPolicy_var bands_policy_ptr = RTCORBA::PriorityBandedConnectionPolicy::_narrow (bands_policy); @@ -502,14 +576,16 @@ TAO_RT_Protocols_Hooks::get_selector_bands_policy_hook (CORBA::Policy *bands_pol priority_bands_policy->priority_bands_rep (); for (CORBA::ULong i = 0; i < bands.length (); ++i) - if (bands[i].low <= priority && bands[i].high >= priority) - { - min_priority = bands[i].low; - max_priority = bands[i].high; - - in_range = 1; - break; - } + { + if (bands[i].low <= priority && bands[i].high >= priority) + { + min_priority = bands[i].low; + max_priority = bands[i].high; + + in_range = 1; + break; + } + } } int @@ -524,19 +600,24 @@ TAO_RT_Protocols_Hooks::get_thread_CORBA_priority (CORBA::Short &priority ACE_CHECK_RETURN (-1); if (result == -1) - return result; + { + return result; + } return 0; } int -TAO_RT_Protocols_Hooks::get_thread_native_priority (CORBA::Short &native_priority - ACE_ENV_ARG_DECL_NOT_USED) +TAO_RT_Protocols_Hooks::get_thread_native_priority ( + CORBA::Short &native_priority + ACE_ENV_ARG_DECL_NOT_USED + ) { ACE_hthread_t current; ACE_Thread::self (current); int priority; + if (ACE_Thread::getprio (current, priority) == -1) { ACE_DEBUG ((LM_DEBUG, @@ -547,21 +628,24 @@ TAO_RT_Protocols_Hooks::get_thread_native_priority (CORBA::Short &native_priorit return -1; } - native_priority = - CORBA::Short (priority); + native_priority = CORBA::Short (priority); return 0; } int -TAO_RT_Protocols_Hooks::get_thread_CORBA_and_native_priority (CORBA::Short &priority, - CORBA::Short &native_priority - ACE_ENV_ARG_DECL) +TAO_RT_Protocols_Hooks::get_thread_CORBA_and_native_priority ( + CORBA::Short &priority, + CORBA::Short &native_priority + ACE_ENV_ARG_DECL + ) { int result = this->get_thread_native_priority (native_priority ACE_ENV_ARG_PARAMETER); if (result == -1) - return result; + { + return result; + } TAO_Priority_Mapping *priority_mapping = this->mapping_manager_.in ()->mapping (); @@ -586,23 +670,34 @@ TAO_RT_Protocols_Hooks::set_thread_CORBA_priority (CORBA::Short priority this->mapping_manager_.in ()->mapping (); CORBA::Short native_priority; + if (priority_mapping->to_native (priority, native_priority) == 0) - return -1; + { + return -1; + } return this->set_thread_native_priority (native_priority ACE_ENV_ARG_PARAMETER); } int -TAO_RT_Protocols_Hooks::set_thread_native_priority (CORBA::Short native_priority - ACE_ENV_ARG_DECL_NOT_USED) +TAO_RT_Protocols_Hooks::set_thread_native_priority ( + CORBA::Short native_priority + ACE_ENV_ARG_DECL_NOT_USED + ) { ACE_hthread_t current; ACE_Thread::self (current); - if (ACE_Thread::setprio (current, native_priority) == -1) { - ACE_ERROR_RETURN((LM_ERROR, ACE_LIB_TEXT("(%N,%l) Error setting thread priority to %d, errno %d %m\n"), native_priority, errno ), -1); - } + if (ACE_Thread::setprio (current, native_priority) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_LIB_TEXT ("(%N,%l) Error setting thread ") + ACE_LIB_TEXT ("priority to %d, errno %d %m\n"), + native_priority, + errno ), + -1); + } return 0; } @@ -666,16 +761,20 @@ TAO_RT_Protocols_Hooks::set_default_policies (ACE_ENV_SINGLE_ARG_DECL) RTCORBA::ClientProtocolPolicy_var safe_client_protocol_policy = client_protocol_policy; - this->orb_core_->get_default_policies ()->set_policy (client_protocol_policy - ACE_ENV_ARG_PARAMETER); + this->orb_core_->get_default_policies ()->set_policy ( + client_protocol_policy + ACE_ENV_ARG_PARAMETER + ); ACE_CHECK_RETURN (-1); return 0; } int -TAO_RT_Protocols_Hooks::set_default_server_protocol_policy (TAO_Acceptor_Registry &acceptor_registry - ACE_ENV_ARG_DECL) +TAO_RT_Protocols_Hooks::set_default_server_protocol_policy ( + TAO_Acceptor_Registry &acceptor_registry + ACE_ENV_ARG_DECL + ) { RTCORBA::ProtocolList protocols; @@ -707,7 +806,9 @@ TAO_RT_Protocols_Hooks::set_default_server_protocol_policy (TAO_Acceptor_Registr // being responsible for creation of its own default protocol // properties. protocols[current_length].transport_protocol_properties = - TAO_Protocol_Properties_Factory::create_transport_protocol_property ((*acceptor)->tag ()); + TAO_Protocol_Properties_Factory::create_transport_protocol_property ( + (*acceptor)->tag () + ); } // Set ServerProtocolPolicy. @@ -719,8 +820,10 @@ TAO_RT_Protocols_Hooks::set_default_server_protocol_policy (TAO_Acceptor_Registr RTCORBA::ServerProtocolPolicy_var safe_server_protocol_policy = server_protocol_policy; - this->orb_core_->get_default_policies ()->set_policy (server_protocol_policy - ACE_ENV_ARG_PARAMETER); + this->orb_core_->get_default_policies ()->set_policy ( + server_protocol_policy + ACE_ENV_ARG_PARAMETER + ); ACE_CHECK_RETURN (-1); return 0; @@ -730,7 +833,8 @@ ACE_STATIC_SVC_DEFINE (TAO_RT_Protocols_Hooks, ACE_TEXT ("RT_Protocols_Hooks"), ACE_SVC_OBJ_T, &ACE_SVC_NAME (TAO_RT_Protocols_Hooks), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + ACE_Service_Type::DELETE_THIS + | ACE_Service_Type::DELETE_OBJ, 0) ACE_FACTORY_DEFINE (TAO_RTCORBA, TAO_RT_Protocols_Hooks) |