From f7c744ef1342f817f80cc93b45804266fcf7284b Mon Sep 17 00:00:00 2001 From: bala Date: Sat, 19 Aug 2000 20:43:54 +0000 Subject: ChangeLogTag: Sat Aug 19 15:20:34 2000 Balachandran Natarajan --- TAO/ChangeLogs/ChangeLog-02a | 48 +++++++++- TAO/tao/GIOP_Message_Acceptors.cpp | 185 +++++++++++++++---------------------- TAO/tao/GIOP_Message_Acceptors.h | 5 + TAO/tao/GIOP_Message_Lite.cpp | 183 +++++++++++++++--------------------- TAO/tao/GIOP_Message_Lite.h | 7 +- TAO/tao/GIOP_Server_Request.cpp | 13 ++- TAO/tao/GIOP_Server_Request.h | 18 +++- TAO/tao/GIOP_Server_Request.i | 9 +- TAO/tao/Servant_Base.cpp | 21 +++-- TAO/tao/Server_Request.h | 3 + 10 files changed, 249 insertions(+), 243 deletions(-) diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 38f87dfd250..bc0250cc1ab 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,47 @@ +Sat Aug 19 15:20:34 2000 Balachandran Natarajan + + * tao/GIOP_Message_Acceptors.cpp (process_client_locate): + * tao/GIOP_Message_Acceptors.h: + * tao/GIOP_Message_Lite.h: + * tao/GIOP_Message_Lite.cpp: Added a new method + find_ior_in_table. + + * tao/GIOP_Server_Request.cpp: + * tao/GIOP_Server_Request.i: + * tao/GIOP_Server_Request.h: Added an argument to one of the + constructors that would indicate whether a reply should be sent + by this class or not. Also added a inline method that would + return that value. Further removed the version argument in the + constructor. It is no longer needed. + + * tao/Servant_Base.cpp: Added a check to see whether the deferred + reply flag is set before a reply is sent by calling the + ServerRequest class. + + * tao/Servant_request.h: Added a virtual method that would return + the deffered flag value. + + The whole set of changes were required to interoperate properly + with other ORBs. The problem was when other ORBs sent a + LocateRequest message. The LocateRequest classes after receiving + the call make an upcall on to the servant. This is essentially + done by calling the _non_existent () method on the servant to + test whether the object is active. The existing setup processed + the upcall in a fashion similar to that of a Request + message. For a Request message, once the upcall is made on to + the servant, the skeleton code prepares the reply and also + marshalls the return value. Then the Servant_Base class sends + the reply on the wire. But, for a LocateRequest message we need + not do the above. We need to just make an upcall and then + prepare the right reply if the call returned properly. If not we + need to propagate the exception received from the upcall. To use + the existing setup to make an upcall, I introduced a flag that + would indicate to the Servant_Base class whether it needs to + send the reply on the wire. With this change the + interoperability problem that we had with Orbix2000 and reported + by Boeing should be gone. + + Sat Aug 19 11:10:40 2000 Carlos O'Ryan * tao/POA.cpp: @@ -19,11 +63,11 @@ Sat Aug 19 13:50:00 2000 Kirthika Parameswaran * TAO_IDL/be/be_visitor_operation/interceptors_ch.cpp: * TAO_IDL/be/be_visitor_operation/interceptors_cs.cpp: - * TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp: + * TAO_IDL/be/be_visitor_operation/interceptors_sh.cpp: * TAO_IDL/be/be_visitor_operation/interceptors_ss.cpp: Made the formal arguments to the RequestInfo constructor unique to resolve name clashing errors. - + Fri Aug 18 23:20:56 2000 Marina Spivak * tao/RTCORBA.pidl diff --git a/TAO/tao/GIOP_Message_Acceptors.cpp b/TAO/tao/GIOP_Message_Acceptors.cpp index 4882db9be46..c5194879db8 100644 --- a/TAO/tao/GIOP_Message_Acceptors.cpp +++ b/TAO/tao/GIOP_Message_Acceptors.cpp @@ -78,20 +78,13 @@ TAO_GIOP_Message_Acceptors:: TAO_ORB_Core* orb_core, TAO_InputCDR &input) { - // Get the revision info - TAO_GIOP_Version version (this->major_version (), - this->minor_version ()); - - - // This will extract the request header, set // and as appropriate. TAO_GIOP_ServerRequest request (this, input, *this->output_, transport, - orb_core, - version); + orb_core); CORBA::Environment &ACE_TRY_ENV = TAO_default_environment (); @@ -113,57 +106,10 @@ TAO_GIOP_Message_Acceptors:: response_required = request.response_expected (); -#if (TAO_NO_IOR_TABLE == 0) - const CORBA::Octet *object_key = - request.object_key ().get_buffer (); - - if (ACE_OS::memcmp (object_key, - &TAO_POA::objectkey_prefix[0], - TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) - { - ACE_CString object_id (ACE_reinterpret_cast (const char *, - object_key), - request.object_key ().length (), - 0, - 0); - - // @@ This debugging output should *NOT* be used since the - // object key string is not null terminated, nor can it - // be null terminated without copying. No copying should - // be done since performance is somewhat important here. - // So, just remove the debugging output entirely. - // - // if (TAO_debug_level > 0) - // ACE_DEBUG ((LM_DEBUG, - // "Simple Object key %s. " - // "Doing the Table Lookup ...\n", - // object_id.c_str ())); - - //CORBA::Object_ptr object_reference = - CORBA::Object_var object_reference = - CORBA::Object::_nil (); - - // Do the Table Lookup. - int status = - orb_core->orb ()->_tao_find_in_IOR_table (object_id, - object_reference.out ()); - - // If ObjectID not in table or reference is nil raise - // OBJECT_NOT_EXIST. - - if (status == -1 || CORBA::is_nil (object_reference.in ())) - ACE_TRY_THROW (CORBA::OBJECT_NOT_EXIST ()); - - // ObjectID present in the table with an associated NON-NULL - // reference. Throw a forward request exception. - - /*CORBA::Object_ptr dup = - CORBA::Object::_duplicate (object_reference);*/ - - // @@ We could simply write the response at this point... - ACE_TRY_THROW (PortableServer::ForwardRequest (object_reference.in ())); - } -#endif /* TAO_NO_IOR_TABLE */ + this->find_ior_in_table (request.object_key (), + orb_core, + ACE_TRY_ENV); + ACE_TRY_CHECK; // Do this before the reply is sent. orb_core->object_adapter ()->dispatch_servant ( @@ -314,10 +260,6 @@ TAO_GIOP_Message_Acceptors:: TAO_ORB_Core* orb_core, TAO_InputCDR &input) { - // Get the revision info - TAO_GIOP_Version version (this->major_version (), - this->minor_version ()); - // This will extract the request header, set as // appropriate. TAO_GIOP_Locate_Request_Header locate_request (input, @@ -338,53 +280,12 @@ TAO_GIOP_Message_Acceptors:: if (parse_error != 0) ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO)); -#if (TAO_NO_IOR_TABLE == 0) - - const CORBA::Octet *object_key = - locate_request.object_key ().get_buffer (); - - if (ACE_OS::memcmp (object_key, - &TAO_POA::objectkey_prefix[0], - TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) - { - CORBA::ULong len = - locate_request.object_key ().length (); - - ACE_CString object_id (ACE_reinterpret_cast (const char *, - object_key), - len, - 0, - 0); - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Simple Object key %s. Doing the Table Lookup ...\n"), - object_id.c_str ())); - CORBA::Object_ptr object_reference; - - // Do the Table Lookup. - int find_status = - orb_core->orb ()->_tao_find_in_IOR_table (object_id, - object_reference); - - // If ObjectID not in table or reference is nil raise - // OBJECT_NOT_EXIST. - - if (CORBA::is_nil (object_reference) - || find_status == -1) - ACE_TRY_THROW (CORBA::OBJECT_NOT_EXIST ()); - - // ObjectID present in the table with an associated NON-NULL - // reference. Throw a forward request exception. - - CORBA::Object_ptr dup = - CORBA::Object::_duplicate (object_reference); + this->find_ior_in_table (locate_request.object_key (), + orb_core, + ACE_TRY_ENV); + ACE_TRY_CHECK; - // @@ We could simply write the response at this point... - ACE_TRY_THROW (PortableServer::ForwardRequest (dup)); - } -#endif /* TAO_NO_IOR_TABLE */ // Execute a fake request to find out if the object is there or // if the POA can activate it on demand... char repbuf[ACE_CDR::DEFAULT_BUFSIZE]; @@ -392,8 +293,6 @@ TAO_GIOP_Message_Acceptors:: sizeof repbuf); // This output CDR is not used! - // This could be tricky if the target_address does not have the - // object key. Till then .. Bala TAO_ObjectKey tmp_key (locate_request.object_key ().length (), locate_request.object_key ().length (), locate_request.object_key ().get_buffer (), @@ -403,15 +302,18 @@ TAO_GIOP_Message_Acceptors:: parse_error = 1; CORBA::ULong req_id = locate_request.request_id (); + // We will send the reply. The ServerRequest class need not send + // the reply + CORBA::Boolean deferred_reply = 1; TAO_GIOP_ServerRequest server_request (this, req_id, response_required, + deferred_reply, tmp_key, "_non_existent", dummy_output, transport, orb_core, - version, parse_error); if (parse_error != 0) ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, @@ -488,6 +390,67 @@ TAO_GIOP_Message_Acceptors:: status_info); } +void +TAO_GIOP_Message_Acceptors:: + find_ior_in_table (TAO_ObjectKey &object_key, + TAO_ORB_Core *orb_core, + CORBA::Environment &ACE_TRY_ENV) +{ +#if (TAO_NO_IOR_TABLE == 0) + const CORBA::Octet *key = + object_key.get_buffer (); + + if (ACE_OS::memcmp (key, + &TAO_POA::objectkey_prefix[0], + TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) + { + ACE_CString object_id (ACE_reinterpret_cast (const char *, + key), + object_key.length (), + 0, + 0); + // @@ This debugging output should *NOT* be used since the + // object key string is not null terminated, nor can it + // be null terminated without copying. No copying should + // be done since performance is somewhat important here. + // So, just remove the debugging output entirely. + // + // if (TAO_debug_level > 0) + // ACE_DEBUG ((LM_DEBUG, + // "Simple Object key %s. " + // "Doing the Table Lookup ...\n", + // object_id.c_str ())); + + //CORBA::Object_ptr object_reference = + CORBA::Object_var object_reference = + CORBA::Object::_nil (); + + // Do the Table Lookup. + int status = + orb_core->orb ()->_tao_find_in_IOR_table (object_id, + object_reference.out ()); + + // If ObjectID not in table or reference is nil raise + // OBJECT_NOT_EXIST. + + if (status == -1 || CORBA::is_nil (object_reference.in ())) + ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); + + // ObjectID present in the table with an associated NON-NULL + // reference. Throw a forward request exception. + + /*CORBA::Object_ptr dup = + CORBA::Object::_duplicate (object_reference);*/ + + // @@ We could simply write the response at this point... + ACE_THROW (PortableServer::ForwardRequest (object_reference.in ())); + } +#else + ACE_UNUSED_ARG (object_key); + ACE_UNUSED_ARG (orb_core); + ACE_UNUSED_ARG (ACE_TRY_ENV); +#endif /* TAO_NO_IOR_TABLE */ +} int TAO_GIOP_Message_Acceptors:: diff --git a/TAO/tao/GIOP_Message_Acceptors.h b/TAO/tao/GIOP_Message_Acceptors.h index d579f91966b..5c0d6e825ba 100644 --- a/TAO/tao/GIOP_Message_Acceptors.h +++ b/TAO/tao/GIOP_Message_Acceptors.h @@ -97,6 +97,11 @@ private: // and are set as part of the // message processing. + void find_ior_in_table (TAO_ObjectKey &object_key, + TAO_ORB_Core *orb_core, + CORBA::Environment &ACE_TRY_ENV); + // Check for the Object id in the IOR table if TAO_NO_IOR_TABLE == 0 + CORBA::Octet major_version (void); CORBA::Octet minor_version (void); diff --git a/TAO/tao/GIOP_Message_Lite.cpp b/TAO/tao/GIOP_Message_Lite.cpp index 339c15d85f5..3f527391add 100644 --- a/TAO/tao/GIOP_Message_Lite.cpp +++ b/TAO/tao/GIOP_Message_Lite.cpp @@ -560,18 +560,13 @@ TAO_GIOP_Message_Lite:: TAO_ORB_Core* orb_core, TAO_InputCDR &input) { - // Get the revision info - TAO_GIOP_Version version (TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); - // This will extract the request header, set // and as appropriate. TAO_GIOP_ServerRequest request (this, input, *this->output_, transport, - orb_core, - version); + orb_core); CORBA::Environment &ACE_TRY_ENV = TAO_default_environment (); @@ -593,56 +588,10 @@ TAO_GIOP_Message_Lite:: response_required = request.response_expected (); -#if (TAO_NO_IOR_TABLE == 0) - const CORBA::Octet *object_key = - request.object_key ().get_buffer (); - - if (ACE_OS::memcmp (object_key, - &TAO_POA::objectkey_prefix[0], - TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) - { - ACE_CString object_id (ACE_reinterpret_cast (const char *, - object_key), - request.object_key ().length (), - 0, - 0); - - // @@ This debugging output should *NOT* be used since the - // object key string is not null terminated, nor can it - // be null terminated without copying. No copying should - // be done since performance is somewhat important here. - // So, just remove the debugging output entirely. - // - // if (TAO_debug_level > 0) - // ACE_DEBUG ((LM_DEBUG, - // "Simple Object key %s. " - // "Doing the Table Lookup ...\n", - // object_id.c_str ())); - - CORBA::Object_var object_reference = - CORBA::Object::_nil (); - - // Do the Table Lookup. - int status = - orb_core->orb ()->_tao_find_in_IOR_table (object_id, - object_reference.out ()); - - // If ObjectID not in table or reference is nil raise - // OBJECT_NOT_EXIST. - - if (status == -1 || CORBA::is_nil (object_reference.in ())) - ACE_TRY_THROW (CORBA::OBJECT_NOT_EXIST ()); - - // ObjectID present in the table with an associated NON-NULL - // reference. Throw a forward request exception. - - // CORBA::Object_ptr dup = - // CORBA::Object::_duplicate (object_reference); - - // @@ We could simply write the response at this point... - ACE_TRY_THROW (PortableServer::ForwardRequest (object_reference.in ())); - } -#endif /* TAO_NO_IOR_TABLE */ + this->find_ior_in_table (request.object_key (), + orb_core, + ACE_TRY_ENV); + ACE_TRY_CHECK; // Do this before the reply is sent. orb_core->object_adapter ()->dispatch_servant ( @@ -792,10 +741,6 @@ TAO_GIOP_Message_Lite:: TAO_ORB_Core* orb_core, TAO_InputCDR &input) { - // Get the revision info - TAO_GIOP_Version version (TAO_DEF_GIOP_MAJOR, - TAO_DEF_GIOP_MINOR); - // This will extract the request header, set as // appropriate. TAO_GIOP_Locate_Request_Header locate_request (input, @@ -816,53 +761,11 @@ TAO_GIOP_Message_Lite:: if (parse_error != 0) ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO)); -#if (TAO_NO_IOR_TABLE == 0) - - const CORBA::Octet *object_key = - locate_request.object_key ().get_buffer (); - - if (ACE_OS::memcmp (object_key, - &TAO_POA::objectkey_prefix[0], - TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) - { - CORBA::ULong len = - locate_request.object_key ().length (); - - ACE_CString object_id (ACE_reinterpret_cast (const char *, - object_key), - len, - 0, - 0); - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Simple Object key %s. Doing the Table Lookup ...\n"), - object_id.c_str ())); - - CORBA::Object_ptr object_reference; - - // Do the Table Lookup. - int find_status = - orb_core->orb ()->_tao_find_in_IOR_table (object_id, - object_reference); - // If ObjectID not in table or reference is nil raise - // OBJECT_NOT_EXIST. - - if (CORBA::is_nil (object_reference) - || find_status == -1) - ACE_TRY_THROW (CORBA::OBJECT_NOT_EXIST ()); - - // ObjectID present in the table with an associated NON-NULL - // reference. Throw a forward request exception. - - CORBA::Object_ptr dup = - CORBA::Object::_duplicate (object_reference); - - // @@ We could simply write the response at this point... - ACE_TRY_THROW (PortableServer::ForwardRequest (dup)); - } -#endif /* TAO_NO_IOR_TABLE */ + this->find_ior_in_table (locate_request.object_key (), + orb_core, + ACE_TRY_ENV); + ACE_TRY_CHECK; // Execute a fake request to find out if the object is there or // if the POA can activate it on demand... @@ -871,8 +774,6 @@ TAO_GIOP_Message_Lite:: sizeof repbuf); // This output CDR is not used! - // This could be tricky if the target_address does not have the - // object key. Till then .. Bala TAO_ObjectKey tmp_key (locate_request.object_key ().length (), locate_request.object_key ().length (), locate_request.object_key ().get_buffer (), @@ -882,15 +783,18 @@ TAO_GIOP_Message_Lite:: parse_error = 1; CORBA::ULong req_id = locate_request.request_id (); + // We will send the reply and let not the ServerRequest class + // send the reply + CORBA::Boolean deferred_flag = 1; TAO_GIOP_ServerRequest server_request (this, req_id, response_required, + deferred_flag, tmp_key, "_non_existent", dummy_output, transport, orb_core, - version, parse_error); if (parse_error != 0) ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE, @@ -972,6 +876,67 @@ TAO_GIOP_Message_Lite:: } +void +TAO_GIOP_Message_Lite:: + find_ior_in_table (TAO_ObjectKey &object_key, + TAO_ORB_Core *orb_core, + CORBA::Environment &ACE_TRY_ENV) +{ +#if (TAO_NO_IOR_TABLE == 0) + const CORBA::Octet *key = + object_key.get_buffer (); + + if (ACE_OS::memcmp (key, + &TAO_POA::objectkey_prefix[0], + TAO_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) + { + ACE_CString object_id (ACE_reinterpret_cast (const char *, + key), + object_key.length (), + 0, + 0); + // @@ This debugging output should *NOT* be used since the + // object key string is not null terminated, nor can it + // be null terminated without copying. No copying should + // be done since performance is somewhat important here. + // So, just remove the debugging output entirely. + // + // if (TAO_debug_level > 0) + // ACE_DEBUG ((LM_DEBUG, + // "Simple Object key %s. " + // "Doing the Table Lookup ...\n", + // object_id.c_str ())); + + //CORBA::Object_ptr object_reference = + CORBA::Object_var object_reference = + CORBA::Object::_nil (); + + // Do the Table Lookup. + int status = + orb_core->orb ()->_tao_find_in_IOR_table (object_id, + object_reference.out ()); + + // If ObjectID not in table or reference is nil raise + // OBJECT_NOT_EXIST. + + if (status == -1 || CORBA::is_nil (object_reference.in ())) + ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); + + // ObjectID present in the table with an associated NON-NULL + // reference. Throw a forward request exception. + + /*CORBA::Object_ptr dup = + CORBA::Object::_duplicate (object_reference);*/ + + // @@ We could simply write the response at this point... + ACE_THROW (PortableServer::ForwardRequest (object_reference.in ())); + } +#else + ACE_UNUSED_ARG (object_key); + ACE_UNUSED_ARG (orb_core); + ACE_UNUSED_ARG (ACE_TRY_ENV); +#endif /* TAO_NO_IOR_TABLE */ +} int diff --git a/TAO/tao/GIOP_Message_Lite.h b/TAO/tao/GIOP_Message_Lite.h index 1b8ca86c180..c92e9606009 100644 --- a/TAO/tao/GIOP_Message_Lite.h +++ b/TAO/tao/GIOP_Message_Lite.h @@ -139,7 +139,12 @@ private: // and are set as part of the // message processing. - int parse_request_header (TAO_GIOP_ServerRequest &request); + void find_ior_in_table (TAO_ObjectKey &object_key, + TAO_ORB_Core *orb_core, + CORBA::Environment &ACE_TRY_ENV); + // Find the IOR in table + + int parse_request_header (TAO_GIOP_ServerRequest &request); // Parse the Request Message header int parse_locate_header (TAO_GIOP_Locate_Request_Header &request); diff --git a/TAO/tao/GIOP_Server_Request.cpp b/TAO/tao/GIOP_Server_Request.cpp index cd42932b1c9..f020aaf56c8 100644 --- a/TAO/tao/GIOP_Server_Request.cpp +++ b/TAO/tao/GIOP_Server_Request.cpp @@ -52,13 +52,13 @@ TAO_GIOP_ServerRequest:: TAO_InputCDR &input, TAO_OutputCDR &output, TAO_Transport *transport, - TAO_ORB_Core *orb_core, - const TAO_GIOP_Version & /*version*/) + TAO_ORB_Core *orb_core) :mesg_base_ (mesg_base), incoming_ (&input), outgoing_ (&output), transport_(transport), response_expected_ (0), + deferred_reply_ (0), sync_with_server_ (0), lazy_evaluation_ (0), @@ -72,7 +72,6 @@ TAO_GIOP_ServerRequest:: exception_ (0), exception_type_ (TAO_GIOP_NO_EXCEPTION), orb_core_ (orb_core), - // version_ (version), service_info_ (), request_id_ (0), profile_ (orb_core), @@ -86,14 +85,14 @@ TAO_GIOP_ServerRequest:: TAO_GIOP_ServerRequest:: TAO_GIOP_ServerRequest (TAO_Pluggable_Messaging *mesg_base, - CORBA::ULong &request_id, - CORBA::Boolean &response_expected, + CORBA::ULong request_id, + CORBA::Boolean response_expected, + CORBA::Boolean deferred_reply, TAO_ObjectKey &object_key, const ACE_CString &operation, TAO_OutputCDR &output, TAO_Transport *transport, TAO_ORB_Core *orb_core, - const TAO_GIOP_Version & /*version*/, int &parse_error) : mesg_base_ (mesg_base), operation_ (operation), @@ -101,6 +100,7 @@ TAO_GIOP_ServerRequest:: outgoing_ (&output), transport_ (transport), response_expected_ (response_expected), + deferred_reply_ (deferred_reply), sync_with_server_ (0), lazy_evaluation_ (0), @@ -114,7 +114,6 @@ TAO_GIOP_ServerRequest:: exception_ (0), exception_type_ (TAO_GIOP_NO_EXCEPTION), orb_core_ (orb_core), - //version_ (version), service_info_ (), request_id_ (request_id), profile_ (orb_core), diff --git a/TAO/tao/GIOP_Server_Request.h b/TAO/tao/GIOP_Server_Request.h index 495506ab44a..ad500c04c8a 100644 --- a/TAO/tao/GIOP_Server_Request.h +++ b/TAO/tao/GIOP_Server_Request.h @@ -49,19 +49,18 @@ public: TAO_InputCDR &input, TAO_OutputCDR &output, TAO_Transport *transport, - TAO_ORB_Core *orb_core, - const TAO_GIOP_Version &version); + TAO_ORB_Core *orb_core); // Constructor TAO_GIOP_ServerRequest (TAO_Pluggable_Messaging *mesg_base, - CORBA::ULong &request_id, - CORBA::Boolean &response_expected, + CORBA::ULong request_id, + CORBA::Boolean response_expected, + CORBA::Boolean deferred_flag, TAO_ObjectKey &object_key, const ACE_CString &operation, TAO_OutputCDR &output, TAO_Transport *transport, TAO_ORB_Core *orb_core, - const TAO_GIOP_Version &version, int &parse_error); virtual ~TAO_GIOP_ServerRequest (void); @@ -131,6 +130,9 @@ public: virtual CORBA::Boolean response_expected (void) const; // Is the response expected? + virtual CORBA::Boolean deferred_reply (void) const; + // Should the reply be deferred? + virtual void response_expected (CORBA::Boolean response); // Set the response expected flag @@ -206,6 +208,12 @@ private: // 0: oneway (SYNC_NONE or SYNC_WITH_TRANSPORT) // 1: twoway, or oneway (SYNC_WITH_SERVER or SYNC_WITH_TARGET) + CORBA::Boolean deferred_reply_; + // 0: Reply would be sent by the object of this class which is the + // default. + // 1: Reply would not be prepared by this class and it would be + // deferred for somebody + CORBA::Boolean sync_with_server_; // 1: oneway (SYNC_WITH_SERVER) // 0: anything else diff --git a/TAO/tao/GIOP_Server_Request.i b/TAO/tao/GIOP_Server_Request.i index d7b5b4ed167..30da734119b 100644 --- a/TAO/tao/GIOP_Server_Request.i +++ b/TAO/tao/GIOP_Server_Request.i @@ -58,6 +58,13 @@ TAO_GIOP_ServerRequest::response_expected (void) const return this->response_expected_; } +ACE_INLINE CORBA::Boolean +TAO_GIOP_ServerRequest::deferred_reply (void) const +{ + return this->deferred_reply_; +} + + ACE_INLINE void TAO_GIOP_ServerRequest:: response_expected (CORBA::Boolean response) @@ -134,5 +141,3 @@ TAO_GIOP_ServerRequest::profile (void) { return this->profile_; } - - diff --git a/TAO/tao/Servant_Base.cpp b/TAO/tao/Servant_Base.cpp index 7924218ac56..36c0a2dc554 100644 --- a/TAO/tao/Servant_Base.cpp +++ b/TAO/tao/Servant_Base.cpp @@ -202,12 +202,12 @@ void TAO_ServantBase::synchronous_upcall_dispatch(CORBA::ServerRequest &req, const char *opname = req.operation(); // It seems that I might have missed s/g here. What if - // it is a one way that is SYNC_WITH_SERVER. + // it is a one way that is SYNC_WITH_SERVER. // Add the following line to handle this reply send as well. - + // Handle the one ways that are SYNC_WITH_SERVER if (req.sync_with_server ()) - { + { req.send_no_exception_reply (); } @@ -223,14 +223,20 @@ void TAO_ServantBase::synchronous_upcall_dispatch(CORBA::ServerRequest &req, // invoke the right operation on the skeleton class (). // and marshal any results skel (req, derived_this, context, ACE_TRY_ENV); + ACE_TRY_CHECK; // It is our job to send the already marshaled reply, but only // send if it is expected and it has not already been sent - if ((!req.sync_with_server() && req.response_expected())) + + // We send the reply only if it is NOT a SYNC_WITH_SERVER, a + // response is expected and if the reply is not deferred. + if ((!req.sync_with_server () && + req.response_expected () && + !req.deferred_reply ())) { req.tao_send_reply(); - ACE_TRY_CHECK; } + } ACE_CATCH(CORBA::Exception,ex) { @@ -239,6 +245,9 @@ void TAO_ServantBase::synchronous_upcall_dispatch(CORBA::ServerRequest &req, req.tao_send_reply_exception(ex); } ACE_ENDTRY; + ACE_CHECK; + + return; } @@ -465,7 +474,7 @@ TAO_DynamicImplementation::_dispatch (CORBA::ServerRequest &request, if ((!request.sync_with_server() && request.response_expected())) { request.tao_send_reply(); - ACE_TRY_CHECK; + ACE_TRY_CHECK; } } ACE_CATCH(CORBA::Exception,ex) diff --git a/TAO/tao/Server_Request.h b/TAO/tao/Server_Request.h index c33fdad3b27..919aaf550ad 100644 --- a/TAO/tao/Server_Request.h +++ b/TAO/tao/Server_Request.h @@ -166,6 +166,9 @@ public: virtual CORBA::Boolean response_expected (void) const = 0; // is the response expected + virtual CORBA::Boolean deferred_reply (void) const = 0; + // is the reply deferred? + virtual CORBA::Boolean sync_with_server (void) const = 0; // Should we return before dispatching the servant? -- cgit v1.2.1