summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Reference.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/Reference.cpp')
-rw-r--r--cpp/src/Ice/Reference.cpp60
1 files changed, 55 insertions, 5 deletions
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index baf9f9eb719..e3d5a1fa45d 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -603,11 +603,20 @@ IceInternal::FixedReference::FixedReference(const InstancePtr& instance,
const string& facet,
Mode mode,
bool secure,
+ const ProtocolVersion& protocol,
const EncodingVersion& encoding,
- const ConnectionIPtr& fixedConnection) :
- Reference(instance, communicator, id, facet, mode, secure, Ice::Protocol_1_0, encoding, -1, Ice::Context()),
+ const ConnectionIPtr& fixedConnection,
+ int invocationTimeout,
+ const Ice::Context& context,
+ const IceUtil::Optional<bool>& compress) :
+ Reference(instance, communicator, id, facet, mode, secure, protocol, encoding, invocationTimeout, context),
_fixedConnection(fixedConnection)
{
+ if(compress)
+ {
+ _overrideCompress = true;
+ _compress = *compress;
+ }
}
vector<EndpointIPtr>
@@ -658,6 +667,12 @@ IceInternal::FixedReference::getConnectionId() const
return string();
}
+IceUtil::Optional<int>
+IceInternal::FixedReference::getTimeout() const
+{
+ return IceUtil::Optional<int>();
+}
+
ReferencePtr
IceInternal::FixedReference::changeEndpoints(const vector<EndpointIPtr>& /*newEndpoints*/) const
{
@@ -735,6 +750,18 @@ IceInternal::FixedReference::changeConnectionId(const string&) const
return 0; // Keep the compiler happy.
}
+ReferencePtr
+IceInternal::FixedReference::changeConnection(const Ice::ConnectionIPtr& newConnection) const
+{
+ if(newConnection == _fixedConnection)
+ {
+ return FixedReferencePtr(const_cast<FixedReference*>(this));
+ }
+ FixedReferencePtr r = FixedReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
+ r->_fixedConnection = newConnection;
+ return r;
+}
+
bool
IceInternal::FixedReference::isIndirect() const
{
@@ -773,7 +800,7 @@ IceInternal::FixedReference::getRequestHandler(const Ice::ObjectPrxPtr& proxy) c
{
if(_fixedConnection->endpoint()->datagram())
{
- throw NoEndpointException(__FILE__, __LINE__, "");
+ throw NoEndpointException(__FILE__, __LINE__, toString());
}
break;
}
@@ -783,7 +810,7 @@ IceInternal::FixedReference::getRequestHandler(const Ice::ObjectPrxPtr& proxy) c
{
if(!_fixedConnection->endpoint()->datagram())
{
- throw NoEndpointException(__FILE__, __LINE__, "");
+ throw NoEndpointException(__FILE__, __LINE__, toString());
}
break;
}
@@ -805,7 +832,7 @@ IceInternal::FixedReference::getRequestHandler(const Ice::ObjectPrxPtr& proxy) c
}
if(secure && !_fixedConnection->endpoint()->secure())
{
- throw NoEndpointException(__FILE__, __LINE__, "");
+ throw NoEndpointException(__FILE__, __LINE__, toString());
}
_fixedConnection->throwException(); // Throw in case our connection is already destroyed.
@@ -979,6 +1006,12 @@ IceInternal::RoutableReference::getConnectionId() const
return _connectionId;
}
+IceUtil::Optional<int>
+IceInternal::RoutableReference::getTimeout() const
+{
+ return _overrideTimeout ? IceUtil::Optional<int>(_timeout) : IceUtil::None;
+}
+
ReferencePtr
IceInternal::RoutableReference::changeEncoding(const Ice::EncodingVersion& encoding) const
{
@@ -1167,6 +1200,23 @@ IceInternal::RoutableReference::changeConnectionId(const string& id) const
return r;
}
+ReferencePtr
+IceInternal::RoutableReference::changeConnection(const Ice::ConnectionIPtr& connection) const
+{
+ return new FixedReference(getInstance(),
+ getCommunicator(),
+ getIdentity(),
+ getFacet(),
+ getMode(),
+ getSecure(),
+ getProtocol(),
+ getEncoding(),
+ connection,
+ getInvocationTimeout(),
+ getContext()->getValue(),
+ getCompress());
+}
+
bool
IceInternal::RoutableReference::isIndirect() const
{