diff options
-rw-r--r-- | TAO/ChangeLog | 65 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Arguments.h | 2 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Arguments.inl | 8 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp | 109 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h | 67 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp | 6 | ||||
-rw-r--r-- | TAO/tao/DynamicInterface/Request.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/Invocation_Adapter.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/Invocation_Adapter.h | 8 | ||||
-rw-r--r-- | TAO/tao/Invocation_Adapter.inl | 4 | ||||
-rw-r--r-- | TAO/tao/PortableServer/DII_Arguments_Converter.h | 54 | ||||
-rw-r--r-- | TAO/tao/PortableServer/Upcall_Wrapper.cpp | 19 | ||||
-rw-r--r-- | TAO/tao/operation_details.h | 9 | ||||
-rw-r--r-- | TAO/tao/operation_details.inl | 11 | ||||
-rw-r--r-- | TAO/tests/DII_Collocation_Tests/oneway/Collocated_Test.cpp | 4 |
15 files changed, 361 insertions, 12 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index eebc3122532..ecf832dbb1c 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,68 @@ +Fri Aug 18 17:00:15 UTC 2006 Yan Dai <dai_y@ociweb.com> + + Merged OCI changes that fix the problem that CORBA::Request::send_oneway() + crashes on get_in_arg() or gives incorrect arguments when the request is + collocated oneway request. These fixes are combination of + "Tue Dec 27 13:20:58 USMST 2005 Yan Dai <dai_y@ociweb.com>" and + "Tue May 2 16:52:43 UTC 2006 Chad Elliott <elliott_c@ociweb.com>" + (See BugZilla #2545 for details). + Note this only fixed the oneway DII collocation requests, the twoway + collocation request was not tested yet. + + * tao/Invocation_Adapter.cpp: + * tao/Invocation_Adapter.h: + * tao/Invocation_Adapter.inl: + + Added is_dii_request_ data member. + Added an extra parameter is_dii_request(defaults to false - not a dii request) + to the invoke() function so it can be passed to the Operation_Details + to mark the request is a dii request. + + * tao/operation_details.h: + * tao/operation_details.i: + + Added is_dii_request_ data member and the accessor and added the is_dii_request + parameter to the constructor. + + * tao/DynamicInterface/DII_Arguments.h: + * tao/DynamicInterface/DII_Arguments.inl: + + Added accessor to the NVList. + + * tao/PortableServer/Upcall_Wrapper.cpp: + + Updated upcall () to use the DII_Argument_Convert to expand the + DII request parameter from NVList to list of *SArgument. + This would make DII request parameters in NVList from the client + side to be changed to the list of arguments so the server side + can correctly retrieve the arguments. + + * tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp: + * tao/DynamicInterface/DII_Arguments_Converter_Impl.h: + * tao/PortableServer/DII_Arguments_Converter.h: + + An abstract class DII_Arguments_Converter is added for conversion + of the NVList to list of *SArgument. + These new files are added to resolve the library circuit dependency + problem. This makes the conversion of NVList to list of *SArgument + can be done in DynamicInterface instead of in PortableServer. The + expanded skel args are used in get_in_arg() to give the correct + "IN" arguments. + + * tao/DynamicInterface/DII_Invocation_Adapter.cpp: + + Passed is_dii_request true to Invocation_Adapter constructor to + indicate it's a dii request invocation. + + * tao/DynamicInterface/Request.cpp: + + Passed is_dii_request true to construct Invocation_Adapter object to + indicate it's a dii request invocation. + + * tests/DII_Collocation_Tests/oneway/Collocated_Test.cpp: + + Removed the commented include. + Fri Aug 18 16:18:35 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com> * tests/Timed_Buffered_Oneways/client.cpp: diff --git a/TAO/tao/DynamicInterface/DII_Arguments.h b/TAO/tao/DynamicInterface/DII_Arguments.h index 6f362d7a099..fb498aa492d 100644 --- a/TAO/tao/DynamicInterface/DII_Arguments.h +++ b/TAO/tao/DynamicInterface/DII_Arguments.h @@ -81,6 +81,8 @@ namespace TAO // deals with the argument list as a whole. void interceptor_paramlist (Dynamic::ParameterList *); + CORBA::NVList_ptr arg () const; + private: CORBA::NVList_ptr x_; diff --git a/TAO/tao/DynamicInterface/DII_Arguments.inl b/TAO/tao/DynamicInterface/DII_Arguments.inl index 265bffbf7de..5acf60d6876 100644 --- a/TAO/tao/DynamicInterface/DII_Arguments.inl +++ b/TAO/tao/DynamicInterface/DII_Arguments.inl @@ -28,6 +28,14 @@ namespace TAO , lazy_evaluation_ (lazy_eval) { } + + ACE_INLINE + CORBA::NVList_ptr + NVList_Argument::arg () const + { + return this->x_; + } + } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp new file mode 100644 index 00000000000..c3b81769f90 --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.cpp @@ -0,0 +1,109 @@ +// $Id$ +#include "tao/DynamicInterface/DII_Arguments_Converter_Impl.h" +#include "tao/DynamicInterface/DII_Arguments.h" +#include "tao/AnyTypeCode/NVList.h" +#include "tao/AnyTypeCode/Any_Impl.h" +#include "tao/operation_details.h" + + +ACE_RCSID (DynamicInterface, + DII_Arguments_Converter_Impl, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +TAO_DII_Arguments_Converter_Impl::~TAO_DII_Arguments_Converter_Impl (void) +{ +} + + +void +TAO_DII_Arguments_Converter_Impl::convert ( + TAO_ServerRequest & server_request, + TAO::Argument * const args[], + size_t nargs + ACE_ENV_ARG_DECL + ) +{ + // The DII requests on client side always have two arguments + // - one is the return argument and the other is NVList_Argument. + // Since the argument list in the client side is used by server side + // in collocation case and the server expects the list of arguments + // and not the NVList_Argument, we need expand the NVList_Argument + // to be list of Arguments. + + // Before expanding NVList_Argument logic was added, the + // $TAO_ROOT/tests/DII_Collocated_Tests/run_test.pl should fail. + // The servant will get incorrect "IN" parameter from the oneway + // operation with single "IN" parameter and get access violation on + // get_in_arg () from the oneway operation with multiple "IN" + // parameters. + CORBA::NVList_ptr lst + = static_cast<TAO::NVList_Argument *> (server_request.operation_details ()->args()[1])->arg (); + + const CORBA::ULong sz = lst->count (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (sz != nargs - 1) + { + ACE_THROW (CORBA::BAD_PARAM ()); + } + + // To avoid the use of extraction operators on CORBA::Any, we will + // marshal the arguments in the NVList into an output cdr and then + // demarshal them into the TAO::Argument array. + TAO_OutputCDR output; + for (CORBA::ULong i = 0; i < sz; ++i) + { + CORBA::NamedValue_ptr theitem = lst->item (i ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (!(theitem->value ()->impl ()->marshal_value (output))) + { + ACE_THROW (CORBA::BAD_PARAM ()); + } + } + + TAO_InputCDR input (output); + for (CORBA::ULong j = 0; j < sz; ++j) + { + if (!(args[j + 1]->demarshal (input))) + { + ACE_THROW (CORBA::BAD_PARAM ()); + } + } + + TAO_Operation_Details* details + = const_cast <TAO_Operation_Details*> (server_request.operation_details ()); + + // The NVList_Argument in operation details is converted to skel + // args, the invocation of the dii collocation requests should use + // the skel args and not use the stub args. + details->use_stub_args (false); +} + + +// ********************************************************************* + +// Initialization and registration of dynamic service object. + +int +TAO_DII_Arguments_Converter_Impl::Initializer (void) +{ + return ACE_Service_Config::process_directive (ace_svc_desc_TAO_DII_Arguments_Converter_Impl); +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +ACE_STATIC_SVC_DEFINE ( + TAO_DII_Arguments_Converter_Impl, + ACE_TEXT ("DII_Arguments_Converter"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_DII_Arguments_Converter_Impl), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0 + ) + +ACE_FACTORY_DEFINE (TAO_DynamicInterface, TAO_DII_Arguments_Converter_Impl) + diff --git a/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h new file mode 100644 index 00000000000..de3811aa705 --- /dev/null +++ b/TAO/tao/DynamicInterface/DII_Arguments_Converter_Impl.h @@ -0,0 +1,67 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DII_Arguments_Converter_Impl.h + * + * $Id$ + * + * @author Yan Dai <dai_y@ociweb.com> + */ +//============================================================================= + + +#ifndef TAO_DII_ARGUMENTS_CONVERTER_IMPL_H +#define TAO_DII_ARGUMENTS_CONVERTER_IMPL_H + +#include /**/ "ace/pre.h" + +#include "tao/DynamicInterface/dynamicinterface_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/DII_Arguments_Converter.h" + +#include "ace/Service_Config.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + + +/** + * @class DII_Arguments_Converter_Impl + * + * @brief DII_Arguments_Converter_Impl. + * + * This class provides the implementation to expand the DII arguments in NVList + * to the list of arguments. + */ +class TAO_DynamicInterface_Export TAO_DII_Arguments_Converter_Impl + : public TAO_DII_Arguments_Converter +{ +public: + virtual ~TAO_DII_Arguments_Converter_Impl (void); + + virtual void convert ( TAO_ServerRequest & server_request, + TAO::Argument * const args[], + size_t nargs + ACE_ENV_ARG_DECL ); + + // Used to force the initialization of the ORB code. + static int Initializer (void); +}; + +static int +TAO_Requires_DII_Arguments_Converter_Initializer = + TAO_DII_Arguments_Converter_Impl::Initializer (); + +TAO_END_VERSIONED_NAMESPACE_DECL + +ACE_STATIC_SVC_DECLARE (TAO_DII_Arguments_Converter_Impl) +ACE_FACTORY_DECLARE (TAO_DynamicInterface, TAO_DII_Arguments_Converter_Impl) + + +#include /**/ "ace/post.h" + +#endif /* TAO_DII_ARGUMENTS_CONVERTER_IMPL_H */ diff --git a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp index c65c9ee547d..441c1df2f92 100644 --- a/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp +++ b/TAO/tao/DynamicInterface/DII_Invocation_Adapter.cpp @@ -38,7 +38,8 @@ namespace TAO op_len, 0, // Collocation Proxy broker pointer TAO_TWOWAY_INVOCATION, - mode) + mode, + true) // is a dii request , exception_list_ (excp) , request_ (r) { @@ -118,7 +119,8 @@ namespace TAO op_len, b, TAO_TWOWAY_INVOCATION, - mode) + mode, + true) // is a dii request , request_ (req) , rd_ (0) , orb_core_ (oc) diff --git a/TAO/tao/DynamicInterface/Request.cpp b/TAO/tao/DynamicInterface/Request.cpp index 9027cecb530..799870a0f64 100644 --- a/TAO/tao/DynamicInterface/Request.cpp +++ b/TAO/tao/DynamicInterface/Request.cpp @@ -217,7 +217,9 @@ CORBA::Request::send_oneway (ACE_ENV_SINGLE_ARG_DECL) this->opname_, static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 0, - TAO::TAO_ONEWAY_INVOCATION); + TAO::TAO_ONEWAY_INVOCATION, + TAO::TAO_SYNCHRONOUS_INVOCATION, + true); // is_dii_request _tao_call.invoke (0, 0 diff --git a/TAO/tao/Invocation_Adapter.cpp b/TAO/tao/Invocation_Adapter.cpp index bc715ad4bac..8d553843580 100644 --- a/TAO/tao/Invocation_Adapter.cpp +++ b/TAO/tao/Invocation_Adapter.cpp @@ -46,7 +46,8 @@ namespace TAO this->args_, this->number_args_, ex_data, - ex_count); + ex_count, + this->is_dii_request_); this->invoke_i (stub, op_details diff --git a/TAO/tao/Invocation_Adapter.h b/TAO/tao/Invocation_Adapter.h index d62d386c8c7..017851372e1 100644 --- a/TAO/tao/Invocation_Adapter.h +++ b/TAO/tao/Invocation_Adapter.h @@ -108,6 +108,9 @@ namespace TAO * * @param mode Invocation mode. This information is also available * in the IDL file and in the generated code. + * + * @param is_dii_request DII request flag. This flag defaults to false, + * it's set to be true when invoking via DynamicInterface. */ Invocation_Adapter (CORBA::Object_ptr target, Argument **args, @@ -116,7 +119,8 @@ namespace TAO size_t op_len, Collocation_Proxy_Broker *cpb, TAO::Invocation_Type type = TAO_TWOWAY_INVOCATION, - TAO::Invocation_Mode mode = TAO_SYNCHRONOUS_INVOCATION); + TAO::Invocation_Mode mode = TAO_SYNCHRONOUS_INVOCATION, + CORBA::Boolean is_dii_request = false); virtual ~Invocation_Adapter (void); @@ -280,6 +284,8 @@ namespace TAO /// The invocation mode Invocation_Mode const mode_; + /// Flag that indicates a dii request. + CORBA::Boolean is_dii_request_; }; } // End namespace TAO diff --git a/TAO/tao/Invocation_Adapter.inl b/TAO/tao/Invocation_Adapter.inl index 3ee1410310c..a3d8dd5eacc 100644 --- a/TAO/tao/Invocation_Adapter.inl +++ b/TAO/tao/Invocation_Adapter.inl @@ -15,7 +15,8 @@ namespace TAO size_t op_len, Collocation_Proxy_Broker *p, Invocation_Type type, - Invocation_Mode mode) + Invocation_Mode mode, + CORBA::Boolean is_dii_request) : target_ (target) , args_ (args) , number_args_ (arg_number) @@ -24,6 +25,7 @@ namespace TAO , cpb_ (p) , type_ (type) , mode_ (mode) + , is_dii_request_ (is_dii_request) { } } diff --git a/TAO/tao/PortableServer/DII_Arguments_Converter.h b/TAO/tao/PortableServer/DII_Arguments_Converter.h new file mode 100644 index 00000000000..69a16c29f91 --- /dev/null +++ b/TAO/tao/PortableServer/DII_Arguments_Converter.h @@ -0,0 +1,54 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file DII_Arguments_Converter.h + * + * $Id$ + * + * @author Yan Dai <dai_y@ociweb.com> + */ +//============================================================================= + + +#ifndef TAO_DII_ARGUMENTS_CONVERTER_H +#define TAO_DII_ARGUMENTS_CONVERTER_H + +#include /**/ "ace/pre.h" + +#include "portableserver_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/TAO_Server_Request.h" +#include "ace/Service_Object.h" + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class TAO_DII_Arguments_Converter + * + * @brief TAO_DII_Arguments_Converter. + * + * Abstract class that convert the DII arguments in NVList to the + * list of arguments. This is a base class for the actual implementation + * in the DynamicInterface library. + */ +class TAO_PortableServer_Export TAO_DII_Arguments_Converter : public ACE_Service_Object +{ +public: + + virtual void convert ( TAO_ServerRequest & server_request, + TAO::Argument * const args[], + size_t nargs + ACE_ENV_ARG_DECL ) = 0; + +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* TAO_DII_ARGUMENTS_CONVERTER_H */ diff --git a/TAO/tao/PortableServer/Upcall_Wrapper.cpp b/TAO/tao/PortableServer/Upcall_Wrapper.cpp index 2e9b1f1564d..e3fa5544e75 100644 --- a/TAO/tao/PortableServer/Upcall_Wrapper.cpp +++ b/TAO/tao/PortableServer/Upcall_Wrapper.cpp @@ -2,6 +2,7 @@ #include "tao/PortableServer/Upcall_Wrapper.h" #include "tao/PortableServer/Upcall_Command.h" +#include "tao/PortableServer/DII_Arguments_Converter.h" #if TAO_HAS_INTERCEPTORS == 1 # include "tao/ServerRequestInterceptor_Adapter.h" @@ -38,6 +39,24 @@ TAO::Upcall_Wrapper::upcall (TAO_ServerRequest & server_request, ACE_ENV_ARG_DECL ) { + if (server_request.collocated () + && server_request.operation_details ()->is_dii_request ()) + { + TAO_DII_Arguments_Converter* dii_arguments_converter + = ACE_Dynamic_Service<TAO_DII_Arguments_Converter>::instance ("DII_Arguments_Converter"); + + if (dii_arguments_converter != 0) + { + dii_arguments_converter->convert (server_request, + args, + nargs + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + else + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + if (server_request.incoming ()) { this->pre_upcall (*server_request.incoming (), diff --git a/TAO/tao/operation_details.h b/TAO/tao/operation_details.h index 15fd2ed19bc..70e5344e7e7 100644 --- a/TAO/tao/operation_details.h +++ b/TAO/tao/operation_details.h @@ -75,7 +75,8 @@ public: TAO::Argument **args = 0, CORBA::ULong num_args = 0, TAO::Exception_Data *ex_data = 0, - CORBA::ULong ex_count = 0); + CORBA::ULong ex_count = 0, + CORBA::Boolean is_dii_request = false); /// Operation name const char* opname (void) const; @@ -166,6 +167,9 @@ public: CORBA::Long ft_retention_id (void) const; #endif /*TAO_HAS_INTERCEPTORS == 1*/ + /// Accessor for is_dii_request_ flag. + CORBA::Boolean is_dii_request (void) const; + private: /// Name of the operation being invoked. @@ -217,6 +221,9 @@ private: /// FT request retention id CORBA::Long ft_retention_id_; #endif /*TAO_HAS_INTERCEPTORS == 1*/ + + /// The dii request flag. + CORBA::Boolean is_dii_request_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/operation_details.inl b/TAO/tao/operation_details.inl index af624b2045c..61063aa9a60 100644 --- a/TAO/tao/operation_details.inl +++ b/TAO/tao/operation_details.inl @@ -10,7 +10,8 @@ TAO_Operation_Details::TAO_Operation_Details (const char *name, TAO::Argument **args, CORBA::ULong num, TAO::Exception_Data *data, - CORBA::ULong count) + CORBA::ULong count, + CORBA::Boolean is_dii_request) : opname_ (name) , opname_len_ (len) , request_id_ (0) @@ -25,6 +26,7 @@ TAO_Operation_Details::TAO_Operation_Details (const char *name, , ft_expiration_time_ (0) , ft_retention_id_ (0) #endif /*TAO_HAS_INTERCEPTORS == 1*/ + , is_dii_request_ (is_dii_request) { } @@ -208,4 +210,11 @@ TAO_Operation_Details::ft_retention_id (void) const } #endif /*TAO_HAS_INTERCEPTORS == 1*/ + +ACE_INLINE CORBA::Boolean +TAO_Operation_Details::is_dii_request (void) const +{ + return this->is_dii_request_; +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tests/DII_Collocation_Tests/oneway/Collocated_Test.cpp b/TAO/tests/DII_Collocation_Tests/oneway/Collocated_Test.cpp index 3e2bab6c3fc..ccf9170dc2a 100644 --- a/TAO/tests/DII_Collocation_Tests/oneway/Collocated_Test.cpp +++ b/TAO/tests/DII_Collocation_Tests/oneway/Collocated_Test.cpp @@ -1,9 +1,5 @@ //$Id$ -// This include is needed for static builds to initialize DII_Arguments_Converter -// service object. -//#include "tao/DynamicInterface/DII_Arguments_Converter_Impl.h" - #include "Server_Task.h" #include "Client_Task.h" #include "ace/Get_Opt.h" |