Define QuicServerId::operator!=(). PiperOrigin-RevId: 378922107
diff --git a/quic/core/crypto/quic_crypto_client_config.cc b/quic/core/crypto/quic_crypto_client_config.cc index a3ec4ee..99f9279 100644 --- a/quic/core/crypto/quic_crypto_client_config.cc +++ b/quic/core/crypto/quic_crypto_client_config.cc
@@ -848,7 +848,7 @@ QuicServerId suffix_server_id(canonical_suffixes_[i], server_id.port(), server_id.privacy_mode_enabled()); auto it = canonical_server_map_.lower_bound(suffix_server_id); - if (it == canonical_server_map_.end() || !(it->first == suffix_server_id)) { + if (it == canonical_server_map_.end() || it->first != suffix_server_id) { // This is the first host we've seen which matches the suffix, so make it // canonical. Use |it| as position hint for faster insertion. canonical_server_map_.insert(
diff --git a/quic/core/quic_server_id.cc b/quic/core/quic_server_id.cc index 0eb5cc3..0c03451 100644 --- a/quic/core/quic_server_id.cc +++ b/quic/core/quic_server_id.cc
@@ -31,4 +31,8 @@ host_ == other.host_ && port_ == other.port_; } +bool QuicServerId::operator!=(const QuicServerId& other) const { + return !(*this == other); +} + } // namespace quic
diff --git a/quic/core/quic_server_id.h b/quic/core/quic_server_id.h index ef900c1..fa6b3c3 100644 --- a/quic/core/quic_server_id.h +++ b/quic/core/quic_server_id.h
@@ -23,10 +23,12 @@ bool privacy_mode_enabled); ~QuicServerId(); - // Needed to be an element of std::set. + // Needed to be an element of an ordered container. bool operator<(const QuicServerId& other) const; bool operator==(const QuicServerId& other) const; + bool operator!=(const QuicServerId& other) const; + const std::string& host() const { return host_; } uint16_t port() const { return port_; }
diff --git a/quic/core/quic_server_id_test.cc b/quic/core/quic_server_id_test.cc index 752b14d..1ad425a 100644 --- a/quic/core/quic_server_id_test.cc +++ b/quic/core/quic_server_id_test.cc
@@ -86,6 +86,10 @@ QuicServerId b_10_https_right_private("b.com", 10, right_privacy); QuicServerId b_11_https_right_private("b.com", 11, right_privacy); + EXPECT_NE(a_10_https_right_private, a_11_https_right_private); + EXPECT_NE(a_10_https_right_private, b_10_https_right_private); + EXPECT_NE(a_10_https_right_private, b_11_https_right_private); + QuicServerId new_a_10_https_left_private("a.com", 10, left_privacy); QuicServerId new_a_11_https_left_private("a.com", 11, left_privacy); QuicServerId new_b_10_https_left_private("b.com", 10, left_privacy); @@ -106,13 +110,13 @@ QuicServerId new_a_10_https_left_private("a.com", 10, false); - EXPECT_FALSE(new_a_10_https_left_private == a_11_https_right_private); - EXPECT_FALSE(new_a_10_https_left_private == b_10_https_right_private); - EXPECT_FALSE(new_a_10_https_left_private == b_11_https_right_private); + EXPECT_NE(new_a_10_https_left_private, a_11_https_right_private); + EXPECT_NE(new_a_10_https_left_private, b_10_https_right_private); + EXPECT_NE(new_a_10_https_left_private, b_11_https_right_private); } QuicServerId a_10_https_private("a.com", 10, true); QuicServerId new_a_10_https_no_private("a.com", 10, false); - EXPECT_FALSE(new_a_10_https_no_private == a_10_https_private); + EXPECT_NE(new_a_10_https_no_private, a_10_https_private); } } // namespace