diff options
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/GIOP.cpp | 15 | ||||
-rw-r--r-- | TAO/tao/IIOP_Transport.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/Invocation.cpp | 25 | ||||
-rw-r--r-- | TAO/tao/Object.cpp | 17 | ||||
-rw-r--r-- | TAO/tao/PolicyC.h | 2 | ||||
-rw-r--r-- | TAO/tao/PolicyC.i | 14 | ||||
-rw-r--r-- | TAO/tao/Stub.cpp | 67 | ||||
-rw-r--r-- | TAO/tao/UIOP_Transport.cpp | 2 |
8 files changed, 112 insertions, 32 deletions
diff --git a/TAO/tao/GIOP.cpp b/TAO/tao/GIOP.cpp index e71e1b29cb3..cafb10f168f 100644 --- a/TAO/tao/GIOP.cpp +++ b/TAO/tao/GIOP.cpp @@ -839,13 +839,16 @@ TAO_GIOP::parse_reply (TAO_Transport *, // For GIOP 1.0 and 1.1 the reply_ctx comes first: // @@ Use <header.giop_version> to make this work with GIOP 1.2 - if ((state.cdr >> reply_ctx) == 0) + if (state.message_type != TAO_GIOP::LocateReply) { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) TAO_GIOP::parse_reply, " - "extracting context\n")); - return -1; + if ((state.cdr >> reply_ctx) == 0) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) TAO_GIOP::parse_reply, " + "extracting context\n")); + return -1; + } } // Read the request id diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index 14733422f44..bbcbfcbdf10 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -156,7 +156,7 @@ TAO_IIOP_Client_Transport::start_locate (TAO_ORB_Core *orb_core, // @@ This should be implemented in the transport object, which // would query the profile to obtain the version... if (TAO_GIOP::start_message (profile->version (), - TAO_GIOP::Request, + TAO_GIOP::LocateRequest, output, orb_core) == 0) ACE_THROW (CORBA::MARSHAL ()); diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp index 17785df71b7..e5cd550f5c4 100644 --- a/TAO/tao/Invocation.cpp +++ b/TAO/tao/Invocation.cpp @@ -131,7 +131,6 @@ TAO_GIOP_Invocation::select_profile_based_on_policy else // mode == TAO::USE_THREAD_PRIORITY { - //@@ Need to convert thread priority into CORBA priority. if (this->orb_core_->get_thread_priority (min_priority) == -1) ACE_THROW_RETURN (CORBA::DATA_CONVERSION (1, CORBA::COMPLETED_NO), @@ -388,7 +387,12 @@ TAO_GIOP_Invocation::invoke (CORBA::Boolean is_roundtrip, // @@ Maybe the right place to do this is once the reply is // received? But what about oneways? - this->stub_->set_valid_profile (); + // @@ Preserve semantics for the case when no ClientPriorityPolicy + // is set/used. For the case when it is, we don't want to set + // anything because usage cases of various profiles based on + // priorities aren't fully supported by MProfiles & friends (yet). + if (this->stub_->profile_in_use () == this->profile_) + this->stub_->set_valid_profile (); return TAO_INVOKE_OK; } @@ -972,7 +976,12 @@ TAO_GIOP_Locate_Request_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV) // @@ Maybe the right place to do this is once the reply is // received? But what about oneways? - this->stub_->set_valid_profile (); + // @@ Preserve semantics for the case when no ClientPriorityPolicy + // is set/used. For the case when it is, we don't want to set + // anything because usage cases of various profiles based on + // priorities aren't fully supported by MProfiles & friends (yet). + if (this->stub_->profile_in_use () == this->profile_) + this->stub_->set_valid_profile (); // Wait for the reply. @@ -1014,7 +1023,15 @@ TAO_GIOP_Locate_Request_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV) // NOTREACHED case TAO_GIOP_OBJECT_FORWARD: - return this->location_forward (this->inp_stream (), ACE_TRY_ENV); + // When ClientPriorityPolicy is not set/used, behave normally. + if (this->stub_->profile_in_use () == this->profile_) + return this->location_forward (this->inp_stream (), + ACE_TRY_ENV); + else + // else, don't change profile structures - we are not ready + // to handle location forwards with priority profiles yet (not enough + // support from MProfiles ...) + return TAO_INVOKE_RESTART; // NOTREACHED } diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp index 4baec1ead66..f940572d545 100644 --- a/TAO/tao/Object.cpp +++ b/TAO/tao/Object.cpp @@ -334,7 +334,7 @@ CORBA_Object::_create_request (CORBA::Context_ptr ctx, // object references. if (ctx || this->protocol_proxy_ == 0) ACE_THROW (CORBA::NO_IMPLEMENT ()); - + ACE_NEW_THROW_EX (request, CORBA::Request (this, operation, @@ -517,9 +517,8 @@ CORBA_Object::_set_policy_overrides ( } CORBA::PolicyList * -CORBA_Object::_get_policy_overrides ( - const CORBA::PolicyTypeSeq & types, - CORBA::Environment &ACE_TRY_ENV) +CORBA_Object::_get_policy_overrides (const CORBA::PolicyTypeSeq & types, + CORBA::Environment &ACE_TRY_ENV) { if (this->protocol_proxy_) return this->protocol_proxy_->get_policy_overrides (types, ACE_TRY_ENV); @@ -528,10 +527,14 @@ CORBA_Object::_get_policy_overrides ( } CORBA::Boolean -CORBA_Object::_validate_connection ( - CORBA::PolicyList_out inconsistent_policies, - CORBA::Environment &ACE_TRY_ENV) +CORBA_Object::_validate_connection (CORBA::PolicyList_out inconsistent_policies, + CORBA::Environment &ACE_TRY_ENV) { + // If the object is collocated then use non_existent to see whether + // it's there. + if (this->is_collocated_) + return !(this->_non_existent (ACE_TRY_ENV)); + if (this->protocol_proxy_) return this->protocol_proxy_->validate_connection (inconsistent_policies, ACE_TRY_ENV); diff --git a/TAO/tao/PolicyC.h b/TAO/tao/PolicyC.h index d40fce08e47..ab85daf7207 100644 --- a/TAO/tao/PolicyC.h +++ b/TAO/tao/PolicyC.h @@ -256,7 +256,7 @@ class TAO_Export CORBA_PolicyList_out public: CORBA_PolicyList_out (CORBA_PolicyList *&); CORBA_PolicyList_out (CORBA_PolicyList_var &); - CORBA_PolicyList_out (CORBA_PolicyList_out &); + CORBA_PolicyList_out (const CORBA_PolicyList_out &); CORBA_PolicyList_out &operator= (CORBA_PolicyList_out &); CORBA_PolicyList_out &operator= (CORBA_PolicyList *); operator CORBA_PolicyList *&(); diff --git a/TAO/tao/PolicyC.i b/TAO/tao/PolicyC.i index 9a54c1273e5..07a2a9a2a93 100644 --- a/TAO/tao/PolicyC.i +++ b/TAO/tao/PolicyC.i @@ -241,7 +241,7 @@ ACE_INLINE CORBA_PolicyList_var::CORBA_PolicyList_var (const CORBA_PolicyList_var &p) // copy constructor { if (p.ptr_) - ACE_NEW (this->ptr_, + ACE_NEW (this->ptr_, CORBA_PolicyList (*p.ptr_)); else this->ptr_ = 0; @@ -267,8 +267,8 @@ CORBA_PolicyList_var::operator= (const CORBA_PolicyList_var &p) // deep copy if (this != &p) { delete this->ptr_; - ACE_NEW_RETURN (this->ptr_, - CORBA_PolicyList (*p.ptr_), + ACE_NEW_RETURN (this->ptr_, + CORBA_PolicyList (*p.ptr_), *this); } return *this; @@ -365,7 +365,7 @@ CORBA_PolicyList_out::CORBA_PolicyList_out (CORBA_PolicyList_var &p) // construc } ACE_INLINE -CORBA_PolicyList_out::CORBA_PolicyList_out (CORBA_PolicyList_out &p) // copy constructor +CORBA_PolicyList_out::CORBA_PolicyList_out (const CORBA_PolicyList_out &p) // copy constructor : ptr_ (p.ptr_) {} @@ -425,7 +425,7 @@ ACE_INLINE CORBA_PolicyTypeSeq_var::CORBA_PolicyTypeSeq_var (const CORBA_PolicyTypeSeq_var &p) { if (p.ptr_) - ACE_NEW (this->ptr_, + ACE_NEW (this->ptr_, CORBA_PolicyTypeSeq (*p.ptr_)); else this->ptr_ = 0; @@ -451,8 +451,8 @@ CORBA_PolicyTypeSeq_var::operator= (const CORBA_PolicyTypeSeq_var &p) // deep co if (this != &p) { delete this->ptr_; - ACE_NEW_RETURN (this->ptr_, - CORBA_PolicyTypeSeq (*p.ptr_), + ACE_NEW_RETURN (this->ptr_, + CORBA_PolicyTypeSeq (*p.ptr_), *this); } return *this; diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp index 41604216d45..4110396a4bf 100644 --- a/TAO/tao/Stub.cpp +++ b/TAO/tao/Stub.cpp @@ -1026,13 +1026,70 @@ TAO_Stub::get_policy_overrides ( } CORBA::Boolean -TAO_Stub::validate_connection ( - CORBA::PolicyList_out inconsistent_policies, - CORBA::Environment &) +TAO_Stub::validate_connection (CORBA::PolicyList_out inconsistent_policies, + CORBA::Environment &ACE_TRY_ENV) { - // @@ What is a good default value to return.... inconsistent_policies = 0; - return 0; + + // Check if we care about Client Priority policy, and store the + // result in the variable called <set>. + int set = 1; + POA_TAO::ClientPriorityPolicy *policy = + this->client_priority (); + if (policy == 0) + set = 0; + else + // Policy is set. + { + TAO::PrioritySpecification priority_spec = + policy->priority_specification (ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + TAO::PrioritySelectionMode mode = priority_spec.mode; + + // Don't care about priority. + if (mode == TAO::USE_NO_PRIORITY) + set = 0; + } + + // Use Locate Request to establish connection/make sure the object + // is there ... + TAO_GIOP_Locate_Request_Invocation locate_request (this, + this->orb_core_); + + //@@ Currently, if we select profiles based on priorities (i.e., + // ClientPriorityPolicy is set), and we get a FORWARD reply to our + // location request, we don't go to the new location - just return 0. + // This is because we don't yet have full support in MProfiles&friends + // for profiles used based on priorities. Once the support is + // there, we should follow a forwarded object to track it down, + // just like in the case where ClientPriorityPolicy is not set. + // At that point, we can remove a lot of 'special case' code from + // this function, along with this comment ;-) (marina). + for (;;) + { + locate_request.start (ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + int status = locate_request.invoke (ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + // We'll get this only if the object was, in fact, forwarded. + if (status == TAO_INVOKE_RESTART) + if (set) + return 0; + else + continue; + + if (status != TAO_INVOKE_OK) + { + ACE_THROW_RETURN (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_YES), + 0); + + } + break; + } + return 1; } #endif /* TAO_HAS_CORBA_MESSAGING */ diff --git a/TAO/tao/UIOP_Transport.cpp b/TAO/tao/UIOP_Transport.cpp index d771e8aec60..8be9f9598d2 100644 --- a/TAO/tao/UIOP_Transport.cpp +++ b/TAO/tao/UIOP_Transport.cpp @@ -157,7 +157,7 @@ TAO_UIOP_Client_Transport::start_locate (TAO_ORB_Core *orb_core, // @@ This should be implemented in the transport object, which // would query the profile to obtain the version... if (TAO_GIOP::start_message (profile->version (), - TAO_GIOP::Request, + TAO_GIOP::LocateRequest, output, orb_core) == 0) ACE_THROW (CORBA::MARSHAL ()); |