summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Reference.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-11-14 10:53:18 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-11-14 10:53:18 +0000
commit4080b9013878e242cf93b9672607c81329380adb (patch)
tree6d97467d754e70b6b79f903fa3ba3ca70052d9b9 /cpp/src/Ice/Reference.cpp
parentBug 429 (diff)
downloadice-4080b9013878e242cf93b9672607c81329380adb.tar.bz2
ice-4080b9013878e242cf93b9672607c81329380adb.tar.xz
ice-4080b9013878e242cf93b9672607c81329380adb.zip
bug 429
Diffstat (limited to 'cpp/src/Ice/Reference.cpp')
-rw-r--r--cpp/src/Ice/Reference.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index bf50f0c0bca..62af778e21e 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -1040,12 +1040,12 @@ IceInternal::IndirectReference::changeTimeout(int newTimeout) const
ReferencePtr
IceInternal::IndirectReference::changeConnectionId(const string& id) const
{
- IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
- if(_locatorInfo)
+ if(id == _connectionId)
{
- LocatorPrx newLocator = LocatorPrx::uncheckedCast(_locatorInfo->getLocator()->ice_connectionId(id));
- r->_locatorInfo = getInstance()->locatorManager()->get(newLocator);
+ return IndirectReferencePtr(const_cast<IndirectReference*>(this));
}
+ IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
+ r->_connectionId = id;
return r;
}
@@ -1129,6 +1129,13 @@ IceInternal::IndirectReference::getConnection(bool& comp) const
const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
endpts = _locatorInfo->getEndpoints(self, cached);
}
+ //
+ // Apply the cached connection id to each endpoint.
+ //
+ for(vector<EndpointIPtr>::iterator p = endpts.begin(); p != endpts.end(); ++p)
+ {
+ *p = (*p)->connectionId(_connectionId);
+ }
vector<EndpointIPtr> filteredEndpoints = filterEndpoints(endpts, getMode(), getSecure());
if(filteredEndpoints.empty())
{
@@ -1197,7 +1204,7 @@ IceInternal::IndirectReference::operator==(const Reference& r) const
{
return false;
}
- return _adapterId == rhs->_adapterId && _locatorInfo == rhs->_locatorInfo;
+ return _adapterId == rhs->_adapterId && _connectionId == rhs->_connectionId && _locatorInfo == rhs->_locatorInfo;
}
bool
@@ -1230,6 +1237,14 @@ IceInternal::IndirectReference::operator<(const Reference& r) const
{
return false;
}
+ if(_connectionId < rhs->_connectionId)
+ {
+ return true;
+ }
+ else if(rhs->_connectionId < _connectionId)
+ {
+ return false;
+ }
return _locatorInfo < rhs->_locatorInfo;
}
}
@@ -1245,6 +1260,7 @@ IceInternal::IndirectReference::clone() const
IceInternal::IndirectReference::IndirectReference(const IndirectReference& r)
: RoutableReference(r),
_adapterId(r._adapterId),
+ _connectionId(r._connectionId),
_locatorInfo(r._locatorInfo)
{
}