From 05bfba37d28400c4aa60eaeae82348d9fe337c20 Mon Sep 17 00:00:00 2001 From: arvindk Date: Mon, 10 Jan 2005 17:01:21 +0000 Subject: ChangeLogTag: Mon Jan 10 10:51:18 2005 Arvind S. Krishna --- TAO/tao/Acceptor_Impl.cpp | 19 ++++++++-- TAO/tao/ChangeLog | 20 +++++++++++ TAO/tao/GIOP_Message_Base.cpp | 30 ++-------------- TAO/tao/GIOP_Message_Base.h | 1 + TAO/tao/GIOP_Message_Generator_Parser_12.cpp | 49 ++++++++++++++++++++++--- TAO/tao/IIOP_Connector.cpp | 1 + TAO/tao/Synch_Invocation.cpp | 53 +++++++++++++++++++++++----- 7 files changed, 131 insertions(+), 42 deletions(-) diff --git a/TAO/tao/Acceptor_Impl.cpp b/TAO/tao/Acceptor_Impl.cpp index 730bb522868..e37ff3d2440 100644 --- a/TAO/tao/Acceptor_Impl.cpp +++ b/TAO/tao/Acceptor_Impl.cpp @@ -28,9 +28,13 @@ #include "Thread_Per_Connection_Handler.h" #include "Server_Strategy_Factory.h" #include "ORB_Core.h" -#include "Transport_Cache_Manager.h" +//#include "Transport_Cache_Manager.h" #include "Thread_Lane_Resources.h" -#include "Transport.h" + +#if !defined (TAO_HAS_COLLOCATION) +# include "Transport.h" +#endif + #include "debug.h" #if !defined(__ACE_INLINE__) @@ -81,6 +85,9 @@ template int TAO_Concurrency_Strategy::activate_svc_handler (SVC_HANDLER *sh, void *arg) { + +#if !defined (TAO_HAS_COLLOCATION) + sh->transport ()->opened_as (TAO::TAO_SERVER_ROLE); // Indicate that this transport was opened in the server role @@ -189,6 +196,14 @@ TAO_Concurrency_Strategy::activate_svc_handler (SVC_HANDLER *sh, // Success: #REFCOUNT# is two at this point. return result; +#else + ACE_UNUSED_ARG (sh); + ACE_UNUSED_ARG (arg); + + // Return Dummy success + return 1; +#endif + } ////////////////////////////////////////////////////////////////////////////// diff --git a/TAO/tao/ChangeLog b/TAO/tao/ChangeLog index 30862a3f6a7..f02e9efaab5 100644 --- a/TAO/tao/ChangeLog +++ b/TAO/tao/ChangeLog @@ -1,3 +1,23 @@ +Mon Jan 10 10:51:18 2005 Arvind S. Krishna + + * tao/GIOP_Message_Base.cpp: + * tao/GIOP_Message_Base.h: + * tao/GIOP_Message_Generator_Parser_12.cpp: + * tao/Synch_Invocation.cpp: + + Strategies for cacheing request headers and avoiding + re-marshaling of CORBA request header when sending remote + requests. + + * tao/tao.mpc: + Added the appropriate flags TAO_HAS_NO_HEADER_REMARSHALL and + TAO_HAS_REQUEST_CACHING to the mpc file. + + * tao/Strategies/SHMIOP_Connection_Handler.cpp: + * tao/Strategies/UIOP_Connection_Handler.cpp: + + Resolved compilation errors + Thu Jan 6 13:05:25 2005 Arvind S. Krishna * Strategies/DIOP_Connection_Handler.cpp: diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index 40b32767f39..2d74b0b1179 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -91,8 +91,7 @@ TAO_GIOP_Message_Base::generate_request_header ( generator_parser); // Write the GIOP header first - if (!this->write_protocol_header (TAO_GIOP_REQUEST, - cdr)) + if (!this->write_protocol_header (TAO_GIOP_REQUEST, cdr)) { if (TAO_debug_level) { @@ -240,6 +239,7 @@ TAO_GIOP_Message_Base::read_message (TAO_Transport * /*transport*/, int TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream) { + // Ptr to first buffer. char *buf = (char *) stream.buffer (); @@ -268,7 +268,7 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream) ACE_CDR::swap_4 (ACE_reinterpret_cast (char *, &bodylen), buf + TAO_GIOP_MESSAGE_SIZE_OFFSET); -#endif /* ACE_ENABLE_SWAP_ON_WRITE */ +#endif /*ACE_ENABLE_SWAP_ON_WRITE */ if (TAO_debug_level > 2) { @@ -843,16 +843,6 @@ TAO_GIOP_Message_Base::write_protocol_header (TAO_GIOP_Message_Type t, TAO_OutputCDR &msg) { -#if defined (TAO_HAS_NO_HEADER_REMARSHALL) - static bool once = true; - static int header_length = 0; - - if (once) - { - once = false; -#endif - - // Reset the message type // Reset the message type msg.reset (); @@ -877,26 +867,12 @@ TAO_GIOP_Message_Base::write_protocol_header (TAO_GIOP_Message_Type t, // octet we can have a virtual function do this for us as the // version info , Bala header[6] = (TAO_ENCAP_BYTE_ORDER ^ msg.do_byte_swap ()); - header[7] = CORBA::Octet(t); static int header_size = sizeof (header) / sizeof (header[0]); msg.write_octet_array (header, header_size); -#if defined (TAO_HAS_NO_HEADER_REMARSHALL) - header_length = msg.total_length (); -#endif - - return msg.good_bit (); - -#if defined (TAO_HAS_NO_HEADER_REMARSHALL) - } - - // Skip the required set of bytes - msg.skip_from_start (header_length); return msg.good_bit (); -#endif - } int diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h index d4142a28fdc..b5a556cb6cb 100644 --- a/TAO/tao/GIOP_Message_Base.h +++ b/TAO/tao/GIOP_Message_Base.h @@ -178,6 +178,7 @@ private: /// Writes the GIOP header in to @a msg /// @note If the GIOP header happens to change in the future, we can /// push this method in to the generator_parser classes. + int write_protocol_header (TAO_GIOP_Message_Type t, TAO_OutputCDR &msg); diff --git a/TAO/tao/GIOP_Message_Generator_Parser_12.cpp b/TAO/tao/GIOP_Message_Generator_Parser_12.cpp index cd0f2a63969..b93204e5b1b 100644 --- a/TAO/tao/GIOP_Message_Generator_Parser_12.cpp +++ b/TAO/tao/GIOP_Message_Generator_Parser_12.cpp @@ -10,6 +10,7 @@ #include "tao/ORB_Core.h" #include "tao/Transport.h" #include "tao/CDR.h" +#include "tao/GIOP_Message_State.h" #if !defined (__ACE_INLINE__) # include "GIOP_Message_Generator_Parser_12.inl" @@ -34,6 +35,15 @@ TAO_GIOP_Message_Generator_Parser_12::write_request_header ( // First the request id msg << opdetails.request_id (); +#if defined (TAO_HAS_NO_HEADER_REMARSHALL) + static int counter = 2; + static size_t skip_length; + + if (counter) + { + -- counter; +#endif + const CORBA::Octet response_flags = opdetails.response_flags (); // Here are the Octet values for different policies @@ -47,6 +57,7 @@ TAO_GIOP_Message_Generator_Parser_12::write_request_header ( // We have not implemented the policy INV_NO_RESPONSE for DII. if (response_flags == TAO_TWOWAY_RESPONSE_FLAG) msg << CORBA::Any::from_octet (3); + // Second the response flags // Sync scope - ignored by server if request is not oneway. else if (response_flags == CORBA::Octet (Messaging::SYNC_NONE) @@ -63,6 +74,7 @@ TAO_GIOP_Message_Generator_Parser_12::write_request_header ( else if (response_flags == CORBA::Octet (Messaging::SYNC_WITH_TARGET)) // Return after dispatching servant. msg << CORBA::Any::from_octet (3); + else // Until more flags are defined by the OMG. return 0; @@ -71,7 +83,6 @@ TAO_GIOP_Message_Generator_Parser_12::write_request_header ( CORBA::Octet reserved[3] = {0, 0, 0}; msg.write_octet_array (reserved, 3); - if (this->marshall_target_spec (spec, msg) == 0) return 0; @@ -86,9 +97,18 @@ TAO_GIOP_Message_Generator_Parser_12::write_request_header ( // We align the pointer only if the operation has arguments. if (opdetails.argument_flag () && msg.align_write_ptr (TAO_GIOP_MESSAGE_ALIGN_PTR) == -1) + return 0; + +#if defined (TAO_HAS_NO_HEADER_REMARSHALL) + // Header length of the message + skip_length = msg.total_length (); + } + else { - return 0; + // Skip message to the right location + msg.skip_from_start (skip_length); } +#endif return 1; } @@ -125,12 +145,22 @@ TAO_GIOP_Message_Generator_Parser_12::write_reply_header ( TAO_Pluggable_Reply_Params_Base &reply ACE_ENV_ARG_DECL_NOT_USED /* ACE_ENV_SINGLE_ARG_PARAMETER */ ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { + // Write the request ID output.write_ulong (reply.request_id_); - // Write the reply status +#if defined (TAO_HAS_NO_HEADER_REMARSHALL) + static bool once = true; + static size_t skip_length; + + if (once) + { + once = false; +#endif + + // Write the reply status if (reply.reply_status_ == TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM) { @@ -182,6 +212,17 @@ TAO_GIOP_Message_Generator_Parser_12::write_reply_header ( return 0; } } + +#if defined (TAO_HAS_NO_HEADER_REMARSHALL) + + // Header length of the message + skip_length = output.total_length (); + } + else + { + output.skip_from_start(skip_length); + } +#endif return 1; } diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index 85d18237e5e..8aac8c996e0 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -203,6 +203,7 @@ TAO_IIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *r, timeout = &tmp_zero; } + TAO_IIOP_Connection_Handler *svc_handler = 0; int result = this->base_connector_.connect (svc_handler, remote_address, diff --git a/TAO/tao/Synch_Invocation.cpp b/TAO/tao/Synch_Invocation.cpp index fef4a9676e6..1f39628fb1b 100644 --- a/TAO/tao/Synch_Invocation.cpp +++ b/TAO/tao/Synch_Invocation.cpp @@ -52,9 +52,25 @@ namespace TAO TAO_Synch_Reply_Dispatcher rd (this->resolver_.stub ()->orb_core (), this->details_.reply_service_info ()); +#if !defined (TAO_HAS_HEADER_CACHING) TAO_Target_Specification tspec; - this->init_target_spec (tspec ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); +#else + static TAO_Target_Specification tspec; +#endif + +#if defined (TAO_HAS_HEADER_CACHING) + static bool once = true; + if (once) + { +#endif + once = false; + + this->init_target_spec (tspec ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (TAO_INVOKE_FAILURE); + +#if defined (TAO_HAS_HEADER_CACHING) + } +#endif Invocation_Status s = TAO_INVOKE_FAILURE; @@ -72,14 +88,33 @@ namespace TAO // ending interception flow if things go wrong. The purpose of the // try block is to do just this. ACE_TRY - { - TAO_OutputCDR &cdr = - this->resolver_.transport ()->out_stream (); + { - this->write_header (tspec, - cdr - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (s); +#if defined (TAO_HAS_HEADER_CACHING) + TAO_OutputCDR cdr; +#else + static TAO_OutputCDR &cdr; +#endif + +#if defined (TAO_HAS_HEADER_CACHING) + static bool not_same_header = true; + if (not_same_header) + { + not_same_header = false; + static TAO_OutputCDR &cdr = +#else + TAO_OutputCDR &cdr = +#endif + this->resolver_.transport ()->out_stream (); + + this->write_header (tspec, + cdr + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (s); + +#if defined (TAO_HAS_HEADER_CACHING) + } +#endif this->marshal_data (cdr ACE_ENV_ARG_PARAMETER); -- cgit v1.2.1