diff options
author | Marc Laukien <marc@zeroc.com> | 2004-01-28 16:28:26 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-01-28 16:28:26 +0000 |
commit | 710e4da3853f380f84e01e670b25058351b35adc (patch) | |
tree | f99fd14d018da4708bad7b03ff2af92efcf17155 /cpp | |
parent | minor (diff) | |
download | ice-710e4da3853f380f84e01e670b25058351b35adc.tar.bz2 ice-710e4da3853f380f84e01e670b25058351b35adc.tar.xz ice-710e4da3853f380f84e01e670b25058351b35adc.zip |
started with AMI changes
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/Ice/Proxy.h | 3 | ||||
-rw-r--r-- | cpp/src/Ice/OutgoingAsync.cpp | 10 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 92 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 75 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.h | 5 | ||||
-rw-r--r-- | cpp/src/IcePack/Registry.cpp | 1 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 7 |
7 files changed, 89 insertions, 104 deletions
diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 2f2f4c71456..9485348f18c 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -218,9 +218,6 @@ private: void setup(const ::IceInternal::ReferencePtr&); friend class ::IceProxy::Ice::Object; - - ::std::vector< ::IceInternal::EndpointPtr> - filterEndpoints(const ::std::vector< ::IceInternal::EndpointPtr>&) const; }; } } diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 18041437e92..244f8914456 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -112,11 +112,6 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is) { case DispatchOK: { - // - // Input and output parameters are always sent in an - // encapsulation, which makes it possible to forward - // oneway requests as blobs. - // _is->startReadEncaps(); __response(true); break; @@ -124,11 +119,6 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is) case DispatchUserException: { - // - // Input and output parameters are always sent in an - // encapsulation, which makes it possible to forward - // oneway requests as blobs. - // _is->startReadEncaps(); __response(false); break; diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 19341ccd5b4..bbdec516b03 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -328,20 +328,15 @@ IceProxy::Ice::Object::ice_invoke_async(const AMI_Object_ice_invokePtr& cb, const vector<Byte>& inParams, const Context& context) { - int __cnt = 0; - while(true) + try { - try - { - __checkTwowayOnly("ice_invoke_async"); - Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - __del->ice_invoke_async(cb, operation, mode, inParams, context); - return; - } - catch(const LocalException& __ex) - { - __handleException(__ex, __cnt); - } + __checkTwowayOnly("ice_invoke_async"); + Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); + __del->ice_invoke_async(cb, operation, mode, inParams, context); + } + catch(const LocalException& __ex) + { + cb->__finished(__ex); } } @@ -1063,7 +1058,7 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& ref) endpoints.reserve(connections.size()); transform(connections.begin(), connections.end(), back_inserter(endpoints), ::Ice::constMemFun(&Connection::endpoint)); - endpoints = filterEndpoints(endpoints); + endpoints = __reference->filterEndpoints(endpoints); if(endpoints.empty()) { @@ -1109,7 +1104,7 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& ref) endpoints = __reference->locatorInfo->getEndpoints(__reference, cached); } - vector<EndpointPtr> filteredEndpoints = filterEndpoints(endpoints); + vector<EndpointPtr> filteredEndpoints = __reference->filterEndpoints(endpoints); if(filteredEndpoints.empty()) { NoEndpointException ex(__FILE__, __LINE__); @@ -1163,73 +1158,6 @@ IceDelegateM::Ice::Object::setup(const ReferencePtr& ref) } } -vector<EndpointPtr> -IceDelegateM::Ice::Object::filterEndpoints(const vector<EndpointPtr>& allEndpoints) const -{ - vector<EndpointPtr> endpoints = allEndpoints; - - // - // Filter out unknown endpoints. - // - endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), ::Ice::constMemFun(&Endpoint::unknown)), - endpoints.end()); - - switch(__reference->mode) - { - case Reference::ModeTwoway: - case Reference::ModeOneway: - case Reference::ModeBatchOneway: - { - // - // Filter out datagram endpoints. - // - endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), ::Ice::constMemFun(&Endpoint::datagram)), - endpoints.end()); - break; - } - - case Reference::ModeDatagram: - case Reference::ModeBatchDatagram: - { - // - // Filter out non-datagram endpoints. - // - endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), - not1(::Ice::constMemFun(&Endpoint::datagram))), - endpoints.end()); - break; - } - } - - // - // Randomize the order of endpoints. - // - random_shuffle(endpoints.begin(), endpoints.end()); - - // - // If a secure connection is requested, remove all non-secure - // endpoints. Otherwise make non-secure endpoints preferred over - // secure endpoints by partitioning the endpoint vector, so that - // non-secure endpoints come first. - // - if(__reference->secure) - { - endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), not1(::Ice::constMemFun(&Endpoint::secure))), - endpoints.end()); - } - else - { - // - // We must use stable_partition() instead of just simply - // partition(), because otherwise some STL implementations - // order our now randomized endpoints. - // - stable_partition(endpoints.begin(), endpoints.end(), not1(::Ice::constMemFun(&Endpoint::secure))); - } - - return endpoints; -} - bool IceDelegateD::Ice::Object::ice_isA(const string& __id, const Context& __context) { diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 407a3f9524d..8d316b730e7 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -24,6 +24,7 @@ #include <Ice/LocatorInfo.h> #include <Ice/Locator.h> #include <Ice/StringUtil.h> +#include <Ice/Functional.h> using namespace std; using namespace Ice; @@ -628,13 +629,83 @@ IceInternal::Reference::changeCollocationOptimization(bool newCollocationOptimiz ReferencePtr IceInternal::Reference::changeDefault() const { - RouterInfoPtr defaultRouterInfo = instance->routerManager()->get(instance->referenceFactory()->getDefaultRouter()); - LocatorInfoPtr defaultLocatorInfo = instance->locatorManager()->get(instance->referenceFactory()->getDefaultLocator()); + RouterInfoPtr defaultRouterInfo = instance->routerManager()-> + get(instance->referenceFactory()->getDefaultRouter()); + LocatorInfoPtr defaultLocatorInfo = instance->locatorManager()-> + get(instance->referenceFactory()->getDefaultLocator()); return instance->referenceFactory()->create(identity, context, FacetPath(), ModeTwoway, false, adapterId, endpoints, defaultRouterInfo, defaultLocatorInfo, 0, true); } +vector<EndpointPtr> +IceInternal::Reference::filterEndpoints(const vector<EndpointPtr>& allEndpoints) +{ + vector<EndpointPtr> endpoints = allEndpoints; + + // + // Filter out unknown endpoints. + // + endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), ::Ice::constMemFun(&Endpoint::unknown)), + endpoints.end()); + + switch(mode) + { + case ModeTwoway: + case ModeOneway: + case ModeBatchOneway: + { + // + // Filter out datagram endpoints. + // + endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), ::Ice::constMemFun(&Endpoint::datagram)), + endpoints.end()); + break; + } + + case ModeDatagram: + case ModeBatchDatagram: + { + // + // Filter out non-datagram endpoints. + // + endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), + not1(::Ice::constMemFun(&Endpoint::datagram))), + endpoints.end()); + break; + } + } + + // + // Randomize the order of endpoints. + // + random_shuffle(endpoints.begin(), endpoints.end()); + + // + // If a secure connection is requested, remove all non-secure + // endpoints. Otherwise make non-secure endpoints preferred over + // secure endpoints by partitioning the endpoint vector, so that + // non-secure endpoints come first. + // + if(secure) + { + endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), not1(::Ice::constMemFun(&Endpoint::secure))), + endpoints.end()); + } + else + { + // + // We must use stable_partition() instead of just simply + // partition(), because otherwise some STL implementations + // order our now randomized endpoints. + // + stable_partition(endpoints.begin(), endpoints.end(), not1(::Ice::constMemFun(&Endpoint::secure))); + } + + return endpoints; +} + + IceInternal::Reference::Reference(const InstancePtr& inst, const Identity& ident, const Context& ctx, diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index 7f42a8e596d..9d62c2406a5 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -95,6 +95,11 @@ public: ReferencePtr changeCollocationOptimization(bool) const; ReferencePtr changeDefault() const; + // + // Filter endpoints based on criteria from this reference. + // + std::vector<EndpointPtr> filterEndpoints(const std::vector<EndpointPtr>&); + private: Reference(const InstancePtr&, const Ice::Identity&, const Ice::Context&, const Ice::FacetPath&, Mode, bool, diff --git a/cpp/src/IcePack/Registry.cpp b/cpp/src/IcePack/Registry.cpp index c390071da22..b705bc990f5 100644 --- a/cpp/src/IcePack/Registry.cpp +++ b/cpp/src/IcePack/Registry.cpp @@ -124,7 +124,6 @@ IcePack::Registry::start(bool nowarn, bool requiresInternalEndpoints) _communicator->setDefaultLocator(0); - properties->setProperty("Ice.Daemon", "0"); properties->setProperty("Ice.PrintProcessId", "0"); properties->setProperty("Ice.Warn.Leaks", "0"); diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index ae589c64469..40474e6ba9d 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1265,9 +1265,6 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << sp << nl << "void" << nl << "IceProxy" << scoped << "_async" << paramsDeclAMI << ", const ::Ice::Context& __ctx)"; C << sb; - C << nl << "int __cnt = 0;"; - C << nl << "while(true)"; - C << sb; C << nl << "try"; C << sb; // Async requests may only be sent twoway. @@ -1277,12 +1274,10 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) << thisPointer << ">(__delBase.get());"; C << nl; C << "__del->" << name << "_async" << argsAMI << "__ctx);"; - C << nl << "return;"; C << eb; C << nl << "catch(const ::Ice::LocalException& __ex)"; C << sb; - C << nl << "__handleException(__ex, __cnt);"; - C << eb; + C << nl << "__cb->__finished(__ex);"; C << eb; C << eb; } |