summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Ice/Outgoing.h1
-rw-r--r--cpp/src/Ice/Incoming.cpp16
-rw-r--r--cpp/src/Ice/Outgoing.cpp20
-rw-r--r--cpp/src/Ice/Proxy.cpp18
-rw-r--r--cpp/src/Ice/TraceUtil.cpp64
-rw-r--r--cpp/src/slice2cpp/Gen.cpp6
6 files changed, 88 insertions, 37 deletions
diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h
index 48c3f16d04e..fd9965cc702 100644
--- a/cpp/include/Ice/Outgoing.h
+++ b/cpp/include/Ice/Outgoing.h
@@ -64,7 +64,6 @@ private:
EmitterPtr _emitter;
ReferencePtr _reference;
- bool _sendRef;
std::auto_ptr< ::Ice::LocalException> _exception;
enum
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index c60efce2321..4e5e351dd8a 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -11,6 +11,7 @@
#include <Ice/Incoming.h>
#include <Ice/ObjectAdapter.h>
#include <Ice/ServantLocator.h>
+#include <Ice/Proxy.h>
#include <Ice/Object.h>
#include <Ice/Exception.h>
@@ -29,8 +30,19 @@ void
IceInternal::Incoming::invoke()
{
Current current;
- _is.read(current.identity);
- _is.read(current.facet);
+ Byte gotProxy;
+ _is.read(gotProxy);
+ if (gotProxy)
+ {
+ _is.read(current.proxy);
+ current.identity = current.proxy->ice_getIdentity();
+ current.facet = current.proxy->ice_getFacet();
+ }
+ else
+ {
+ _is.read(current.identity);
+ _is.read(current.facet);
+ }
_is.read(current.operation);
Int sz;
_is.read(sz);
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index fa8dd8b99da..9fe1abc3743 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -13,6 +13,9 @@
#include <Ice/Emitter.h>
#include <Ice/Reference.h>
#include <Ice/Exception.h>
+#include <Ice/Instance.h>
+#include <Ice/Proxy.h>
+#include <Ice/ProxyFactory.h>
using namespace std;
using namespace Ice;
@@ -35,11 +38,10 @@ IceInternal::NonRepeatable::get() const
return _ex.get();
}
-IceInternal::Outgoing::Outgoing(const EmitterPtr& emitter, const ReferencePtr& ref, bool sendRef,
+IceInternal::Outgoing::Outgoing(const EmitterPtr& emitter, const ReferencePtr& ref, bool sendProxy,
const char* operation, const Context& context) :
_emitter(emitter),
_reference(ref),
- _sendRef(sendRef),
_state(StateUnsent),
_is(ref->instance),
_os(ref->instance)
@@ -62,8 +64,18 @@ IceInternal::Outgoing::Outgoing(const EmitterPtr& emitter, const ReferencePtr& r
}
}
- _os.write(_reference->identity);
- _os.write(_reference->facet);
+ if (sendProxy)
+ {
+ _os.write(Byte(1));
+ ObjectPrx proxy = _reference->instance->proxyFactory()->referenceToProxy(_reference);
+ _os.write(proxy);
+ }
+ else
+ {
+ _os.write(Byte(0));
+ _os.write(_reference->identity);
+ _os.write(_reference->facet);
+ }
_os.write(operation);
_os.write(Int(context.size()));
Context::const_iterator p;
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index c47f13a0637..aec89f99e5e 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -513,12 +513,12 @@ IceProxy::Ice::Object::setup(const ReferencePtr& ref)
bool
IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context)
{
- bool __sendRef = false;
+ bool __sendProxy = false;
while (true)
{
try
{
- Outgoing __out(__emitter, __reference, __sendRef, "ice_isA", __context);
+ Outgoing __out(__emitter, __reference, __sendProxy, "ice_isA", __context);
BasicStream* __is = __out.is();
BasicStream* __os = __out.os();
__os->write(__id);
@@ -532,7 +532,7 @@ IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context)
}
catch (const ProxyRequested&)
{
- __sendRef = true;
+ __sendProxy = true;
}
}
}
@@ -540,12 +540,12 @@ IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context)
void
IceDelegateM::Ice::Object::ice_ping(const Context& __context)
{
- bool __sendRef = false;
+ bool __sendProxy = false;
while (true)
{
try
{
- Outgoing __out(__emitter, __reference, __sendRef, "ice_ping", __context);
+ Outgoing __out(__emitter, __reference, __sendProxy, "ice_ping", __context);
if (!__out.invoke())
{
throw ::Ice::UnknownUserException(__FILE__, __LINE__);
@@ -554,7 +554,7 @@ IceDelegateM::Ice::Object::ice_ping(const Context& __context)
}
catch (const ProxyRequested&)
{
- __sendRef = true;
+ __sendProxy = true;
}
}
}
@@ -565,12 +565,12 @@ IceDelegateM::Ice::Object::ice_invoke(const string& operation,
vector<Byte>& outParams,
const Context& __context)
{
- bool __sendRef = false;
+ bool __sendProxy = false;
while (true)
{
try
{
- Outgoing __out(__emitter, __reference, __sendRef, operation.c_str(), __context);
+ Outgoing __out(__emitter, __reference, __sendProxy, operation.c_str(), __context);
BasicStream* __os = __out.os();
__os->writeBlob(inParams);
__out.invoke();
@@ -584,7 +584,7 @@ IceDelegateM::Ice::Object::ice_invoke(const string& operation,
}
catch (const ProxyRequested&)
{
- __sendRef = true;
+ __sendProxy = true;
}
}
}
diff --git a/cpp/src/Ice/TraceUtil.cpp b/cpp/src/Ice/TraceUtil.cpp
index f2f386aab24..b3f83322328 100644
--- a/cpp/src/Ice/TraceUtil.cpp
+++ b/cpp/src/Ice/TraceUtil.cpp
@@ -11,6 +11,7 @@
#include <Ice/TraceUtil.h>
#include <Ice/Instance.h>
#include <Ice/Object.h>
+#include <Ice/Proxy.h>
#include <Ice/TraceLevels.h>
#include <Ice/Logger.h>
#include <Ice/BasicStream.h>
@@ -65,6 +66,49 @@ printHeader(ostream& s, BasicStream& stream)
s << "\nmessage size = " << size;
}
+static void
+printRequestHeader(ostream& s, BasicStream& stream)
+{
+ string identity;
+ string facet;
+ Byte gotProxy;
+ stream.read(gotProxy);
+ s << "\naddressing = " << static_cast<int>(gotProxy);
+ if (gotProxy)
+ {
+ s << " (proxy)";
+ ObjectPrx proxy;
+ stream.read(proxy);
+ identity = proxy->ice_getIdentity();
+ facet = proxy->ice_getFacet();
+ }
+ else
+ {
+ s << " (identity)";
+ stream.read(identity);
+ stream.read(facet);
+ }
+ s << "\nidentity = " << identity;
+ s << "\nfacet = " << facet;
+ string operation;
+ stream.read(operation);
+ s << "\noperation = " << operation;
+ Int sz;
+ stream.read(sz);
+ s << "\ncontext = ";
+ while (sz--)
+ {
+ pair<string, string> pair;
+ stream.read(pair.first);
+ stream.read(pair.second);
+ s << pair.first << '/' << pair.second;
+ if (sz)
+ {
+ s << ", ";
+ }
+ }
+}
+
void
IceInternal::traceHeader(const char* heading, const BasicStream& str, const ::Ice::LoggerPtr& logger,
const TraceLevelsPtr& tl)
@@ -101,15 +145,7 @@ IceInternal::traceRequest(const char* heading, const BasicStream& str, const ::I
{
s << " (oneway)";
}
- string identity;
- stream.read(identity);
- s << "\nidentity = " << identity;
- string facet;
- stream.read(facet);
- s << "\nfacet = " << facet;
- string operation;
- stream.read(operation);
- s << "\noperation name = " << operation;
+ printRequestHeader(s, stream);
logger->trace(tl->protocolCat, s.str());
stream.i = p;
}
@@ -131,15 +167,7 @@ IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, cons
while (stream.i != stream.b.end())
{
s << "\nrequest #" << cnt++ << ':';
- string identity;
- stream.read(identity);
- s << "\nidentity = " << identity;
- string facet;
- stream.read(facet);
- s << "\nfacet = " << facet;
- string operation;
- stream.read(operation);
- s << "\noperation name = " << operation;
+ printRequestHeader(s, stream);
stream.skipEncaps();
}
logger->trace(tl->protocolCat, s.str());
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 340c3a73edc..b5728046317 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1103,12 +1103,12 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
H << sp << nl << "virtual " << retS << ' ' << name << params << ';';
C << sp << nl << retS << nl << "IceDelegateM" << scoped << paramsDecl;
C << sb;
- C << nl << "bool __sendRef = false;";
+ C << nl << "bool __sendProxy = false;";
C << nl << "while (true)";
C << sb;
C << nl << "try";
C << sb;
- C << nl << "::IceInternal::Outgoing __out(__emitter, __reference, __sendRef, \"" << name << "\", __context);";
+ C << nl << "::IceInternal::Outgoing __out(__emitter, __reference, __sendProxy, \"" << name << "\", __context);";
if (ret || !outParams.empty() || !throws.empty())
{
C << nl << "::IceInternal::BasicStream* __is = __out.is();";
@@ -1167,7 +1167,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << eb;
C << nl << "catch (const ::Ice::ProxyRequested&)";
C << sb;
- C << nl << "__sendRef = true;";
+ C << nl << "__sendProxy = true;";
C << eb;
C << eb;
C << eb;