diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-09-25 16:00:16 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-09-25 16:00:16 +0000 |
commit | 05314b52d3d4454cd9e1b19f5b30d63aac4ab55c (patch) | |
tree | a3fe26ce4cd3115f6c4f1cbcc5042f78876056d0 /cppe/src | |
parent | Fixed a bug in proxy comparison (diff) | |
download | ice-05314b52d3d4454cd9e1b19f5b30d63aac4ab55c.tar.bz2 ice-05314b52d3d4454cd9e1b19f5b30d63aac4ab55c.tar.xz ice-05314b52d3d4454cd9e1b19f5b30d63aac4ab55c.zip |
Fixed a proxy comparison bug
Diffstat (limited to 'cppe/src')
-rw-r--r-- | cppe/src/IceE/Network.cpp | 2 | ||||
-rw-r--r-- | cppe/src/IceE/Reference.cpp | 72 | ||||
-rw-r--r-- | cppe/src/IceE/Reference.h | 11 |
3 files changed, 60 insertions, 25 deletions
diff --git a/cppe/src/IceE/Network.cpp b/cppe/src/IceE/Network.cpp index 6e78008c9b2..d19e05f67e9 100644 --- a/cppe/src/IceE/Network.cpp +++ b/cppe/src/IceE/Network.cpp @@ -972,7 +972,7 @@ IceInternal::getLocalHosts() ::freeifaddrs(ifap); #else - SOCKET fd = createSocket(false); + SOCKET fd = createSocket(); #ifdef _AIX int cmd = CSIOCGIFCONF; diff --git a/cppe/src/IceE/Reference.cpp b/cppe/src/IceE/Reference.cpp index 3af3a3728b3..fe1883d318e 100644 --- a/cppe/src/IceE/Reference.cpp +++ b/cppe/src/IceE/Reference.cpp @@ -287,6 +287,11 @@ IceInternal::Reference::operator==(const Reference& r) const // // Note: if(this == &r) test is performed by each non-abstract derived class. // + + if(getType() != r.getType()) + { + return false; + } if(_mode != r._mode) { @@ -399,6 +404,15 @@ IceInternal::Reference::operator<(const Reference& r) const } } + if(getType() < r.getType()) + { + return true; + } + else if(r.getType() < getType()) + { + return false; + } + return false; } @@ -463,6 +477,12 @@ IceInternal::FixedReference::getFixedConnections() const return _fixedConnections; } +Reference::Type +IceInternal::FixedReference::getType() const +{ + return Fixed; +} + vector<EndpointPtr> IceInternal::FixedReference::getEndpoints() const { @@ -597,10 +617,8 @@ IceInternal::FixedReference::operator<(const Reference& r) const if(Reference::operator==(r)) { const FixedReference* rhs = dynamic_cast<const FixedReference*>(&r); - if(rhs) - { - return _fixedConnections < rhs->_fixedConnections; - } + assert(rhs); + return _fixedConnections < rhs->_fixedConnections; } return false; } @@ -690,10 +708,8 @@ IceInternal::RoutableReference::operator<(const Reference& r) const if(Reference::operator==(r)) { const RoutableReference* rhs = dynamic_cast<const RoutableReference*>(&r); - if(rhs) - { - return _routerInfo < rhs->_routerInfo; - } + assert(rhs); + return _routerInfo < rhs->_routerInfo; } return false; } @@ -735,6 +751,12 @@ IceInternal::DirectReference::DirectReference(const InstancePtr& inst, const Com } #endif +Reference::Type +IceInternal::DirectReference::getType() const +{ + return Direct; +} + vector<EndpointPtr> IceInternal::DirectReference::getEndpoints() const { @@ -895,10 +917,8 @@ IceInternal::DirectReference::operator<(const Reference& r) const if(Parent::operator==(r)) { const DirectReference* rhs = dynamic_cast<const DirectReference*>(&r); - if(rhs) - { - return _endpoints < rhs->_endpoints; - } + assert(rhs); + return _endpoints < rhs->_endpoints; } return false; } @@ -941,6 +961,12 @@ IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const } #endif +Reference::Type +IceInternal::IndirectReference::getType() const +{ + return Indirect; +} + vector<EndpointPtr> IceInternal::IndirectReference::getEndpoints() const { @@ -1143,18 +1169,16 @@ IceInternal::IndirectReference::operator<(const Reference& r) const if(Parent::operator==(r)) { const IndirectReference* rhs = dynamic_cast<const IndirectReference*>(&r); - if(rhs) - { - if(_adapterId < rhs->_adapterId) - { - return true; - } - else if(rhs->_adapterId < _adapterId) - { - return false; - } - return _locatorInfo < rhs->_locatorInfo; - } + assert(rhs); + if(_adapterId < rhs->_adapterId) + { + return true; + } + else if(rhs->_adapterId < _adapterId) + { + return false; + } + return _locatorInfo < rhs->_locatorInfo; } return false; } diff --git a/cppe/src/IceE/Reference.h b/cppe/src/IceE/Reference.h index 5557fbcef95..7c2de6714ed 100644 --- a/cppe/src/IceE/Reference.h +++ b/cppe/src/IceE/Reference.h @@ -47,6 +47,13 @@ public: ModeLast = ModeBatchDatagram }; + enum Type + { + Fixed, + Direct, + Indirect + }; + Mode getMode() const { return _mode; } bool getSecure() const { return _secure; }; const Ice::Identity& getIdentity() const { return _identity; } @@ -58,6 +65,7 @@ public: Ice::CommunicatorPtr getCommunicator() const; + virtual Type getType() const = 0; #ifdef ICEE_HAS_ROUTER virtual RouterInfoPtr getRouterInfo() const { return 0; } #endif @@ -150,6 +158,7 @@ public: const std::vector<Ice::ConnectionPtr>& getFixedConnections() const; + virtual Type getType() const; virtual std::vector<EndpointPtr> getEndpoints() const; #ifdef ICEE_HAS_ROUTER @@ -229,6 +238,7 @@ public: #endif ); + virtual Type getType() const; virtual std::vector<EndpointPtr> getEndpoints() const; DirectReferencePtr changeEndpoints(const std::vector<EndpointPtr>&) const; @@ -285,6 +295,7 @@ public: virtual LocatorInfoPtr getLocatorInfo() const { return _locatorInfo; } + virtual Type getType() const; virtual std::vector<EndpointPtr> getEndpoints() const; virtual ReferencePtr changeLocator(const Ice::LocatorPrx&) const; |