diff options
author | Marc Laukien <marc@zeroc.com> | 2001-09-09 02:36:43 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-09-09 02:36:43 +0000 |
commit | 07da96698f552090621960295ce15666b4af557e (patch) | |
tree | 5080e5e06e8b28fdc708a39c7aad25f9e0bdc739 /cpp/src/Ice/Endpoint.cpp | |
parent | fix (diff) | |
download | ice-07da96698f552090621960295ce15666b4af557e.tar.bz2 ice-07da96698f552090621960295ce15666b4af557e.tar.xz ice-07da96698f552090621960295ce15666b4af557e.zip |
more tests, fixes to operator< and operator==
Diffstat (limited to 'cpp/src/Ice/Endpoint.cpp')
-rw-r--r-- | cpp/src/Ice/Endpoint.cpp | 94 |
1 files changed, 32 insertions, 62 deletions
diff --git a/cpp/src/Ice/Endpoint.cpp b/cpp/src/Ice/Endpoint.cpp index 833af74472b..d8753565839 100644 --- a/cpp/src/Ice/Endpoint.cpp +++ b/cpp/src/Ice/Endpoint.cpp @@ -199,29 +199,23 @@ IceInternal::UnknownEndpoint::equivalent(const AcceptorPtr&) const bool IceInternal::UnknownEndpoint::operator==(const Endpoint& r) const { - return !operator!=(r); -} - -bool -IceInternal::UnknownEndpoint::operator!=(const Endpoint& r) const -{ const UnknownEndpoint* p = dynamic_cast<const UnknownEndpoint*>(&r); if (!p) { - return true; + return false; } if (this == p) { - return false; + return true; } if (_rawBytes != p->_rawBytes) { - return true; + return false; } - return false; + return true; } bool @@ -466,44 +460,37 @@ IceInternal::TcpEndpoint::equivalent(const AcceptorPtr& acceptor) const bool IceInternal::TcpEndpoint::operator==(const Endpoint& r) const { - return !operator!=(r); -} - -bool -IceInternal::TcpEndpoint::operator!=(const Endpoint& r) const -{ const TcpEndpoint* p = dynamic_cast<const TcpEndpoint*>(&r); if (!p) { - return true; + return false; } if (this == p) { - return false; + return true; } if (_port != p->_port) { - return true; + return false; } - + + if(_timeout != p->_timeout) + { + return false; + } + struct sockaddr_in laddr; struct sockaddr_in raddr; getAddress(_host.c_str(), _port, laddr); getAddress(p->_host.c_str(), p->_port, raddr); - if (memcmp(&laddr, &raddr, sizeof(struct sockaddr_in)) != 0) { - return true; - } - - if (_timeout != p->_timeout) - { - return true; + return false; } - return false; + return true; } bool @@ -539,7 +526,6 @@ IceInternal::TcpEndpoint::operator<(const Endpoint& r) const struct sockaddr_in raddr; getAddress(_host.c_str(), _port, laddr); getAddress(p->_host.c_str(), p->_port, raddr); - if (laddr.sin_addr.s_addr < raddr.sin_addr.s_addr) { return true; @@ -786,44 +772,37 @@ IceInternal::SslEndpoint::equivalent(const AcceptorPtr& acceptor) const bool IceInternal::SslEndpoint::operator==(const Endpoint& r) const { - return !operator!=(r); -} - -bool -IceInternal::SslEndpoint::operator!=(const Endpoint& r) const -{ const SslEndpoint* p = dynamic_cast<const SslEndpoint*>(&r); if (!p) { - return true; + return false; } if (this == p) { - return false; + return true; } if (_port != p->_port) { - return true; + return false; } - + + if(_timeout != p->_timeout) + { + return false; + } + struct sockaddr_in laddr; struct sockaddr_in raddr; getAddress(_host.c_str(), _port, laddr); getAddress(p->_host.c_str(), p->_port, raddr); - if (memcmp(&laddr, &raddr, sizeof(struct sockaddr_in)) != 0) { - return true; - } - - if (_timeout != p->_timeout) - { - return true; + return false; } - return false; + return true; } bool @@ -859,7 +838,6 @@ IceInternal::SslEndpoint::operator<(const Endpoint& r) const struct sockaddr_in raddr; getAddress(_host.c_str(), _port, laddr); getAddress(p->_host.c_str(), p->_port, raddr); - if (laddr.sin_addr.s_addr < raddr.sin_addr.s_addr) { return true; @@ -1084,39 +1062,32 @@ IceInternal::UdpEndpoint::equivalent(const AcceptorPtr&) const bool IceInternal::UdpEndpoint::operator==(const Endpoint& r) const { - return !operator!=(r); -} - -bool -IceInternal::UdpEndpoint::operator!=(const Endpoint& r) const -{ const UdpEndpoint* p = dynamic_cast<const UdpEndpoint*>(&r); if (!p) { - return true; + return false; } if (this == p) { - return false; + return true; } if (_port != p->_port) { - return true; + return false; } - + struct sockaddr_in laddr; struct sockaddr_in raddr; getAddress(_host.c_str(), _port, laddr); getAddress(p->_host.c_str(), p->_port, raddr); - if (memcmp(&laddr, &raddr, sizeof(struct sockaddr_in)) != 0) { - return true; + return false; } - return false; + return true; } bool @@ -1152,7 +1123,6 @@ IceInternal::UdpEndpoint::operator<(const Endpoint& r) const struct sockaddr_in raddr; getAddress(_host.c_str(), _port, laddr); getAddress(p->_host.c_str(), p->_port, raddr); - if (laddr.sin_addr.s_addr < raddr.sin_addr.s_addr) { return true; |