gfe-relnote: rename OnConnectivityProbeReceived to OnPacketReceived.
Not flag protected, this is a refactor and has no behavior change.

Currently OnConnectivityProbeReceived is called in two cases:
1. notify the server that a "connectivity probe packet" is received
2. notify the client that a "general packet" is received.

The name of the function is not correct in seconds case. This change
renames the method to OnPacketReceived with an additional parameter
passed to indicate whether the packet is a connectivity probe.

PiperOrigin-RevId: 264168409
Change-Id: I49cd3bc173e1ede3a3b72dc106380769ad50721b
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 9ee89bf..33f3d57 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -1022,8 +1022,8 @@
     connection_->OnPathChallengeFrame(
         QuicPathChallengeFrame(0, {{0, 1, 2, 3, 4, 5, 6, 7}}));
   }
-  session_.OnConnectivityProbeReceived(session_.self_address(),
-                                       new_peer_address);
+  session_.OnPacketReceived(session_.self_address(), new_peer_address,
+                            /*is_connectivity_probe=*/true);
   EXPECT_EQ(old_peer_address, session_.peer_address());
 }
 
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 31c778c..e78b0d0 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -1314,8 +1314,9 @@
                   << " from ip:port: " << last_packet_source_address_.ToString()
                   << " to ip:port: "
                   << last_packet_destination_address_.ToString();
-    visitor_->OnConnectivityProbeReceived(last_packet_destination_address_,
-                                          last_packet_source_address_);
+    visitor_->OnPacketReceived(last_packet_destination_address_,
+                               last_packet_source_address_,
+                               /*is_connectivity_probe=*/true);
   } else if (perspective_ == Perspective::IS_CLIENT) {
     // This node is a client, notify that a speculative connectivity probing
     // packet has been received anyway.
@@ -1326,9 +1327,9 @@
                   << " from ip:port: " << last_packet_source_address_.ToString()
                   << " to ip:port: "
                   << last_packet_destination_address_.ToString();
-    // TODO(zhongyi): change the method name.
-    visitor_->OnConnectivityProbeReceived(last_packet_destination_address_,
-                                          last_packet_source_address_);
+    visitor_->OnPacketReceived(last_packet_destination_address_,
+                               last_packet_source_address_,
+                               /*is_connectivity_probe=*/false);
   } else {
     // This node is not a client (is a server) AND the received packet was
     // NOT connectivity-probing. If the packet had PATH CHALLENGES, send
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index 87d0d81..9754c14 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -134,10 +134,14 @@
   virtual void OnSuccessfulVersionNegotiation(
       const ParsedQuicVersion& version) = 0;
 
-  // Called when a connectivity probe has been received by the connection.
-  virtual void OnConnectivityProbeReceived(
-      const QuicSocketAddress& self_address,
-      const QuicSocketAddress& peer_address) = 0;
+  // Called when a packet has been received by the connection, after being
+  // validated and parsed. Only called when the client receives a valid packet
+  // or the server receives a connectivity probing packet.
+  // |is_connectivity_probe| is true if the received packet is a connectivity
+  // probe.
+  virtual void OnPacketReceived(const QuicSocketAddress& self_address,
+                                const QuicSocketAddress& peer_address,
+                                bool is_connectivity_probe) = 0;
 
   // Called when a blocked socket becomes writable.
   virtual void OnCanWrite() = 0;
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index 836f09f..0bd2c57 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -1013,7 +1013,7 @@
     EXPECT_CALL(visitor_, ShouldKeepConnectionAlive())
         .WillRepeatedly(Return(false));
     EXPECT_CALL(visitor_, OnCongestionWindowChange(_)).Times(AnyNumber());
-    EXPECT_CALL(visitor_, OnConnectivityProbeReceived(_, _)).Times(AnyNumber());
+    EXPECT_CALL(visitor_, OnPacketReceived(_, _, _)).Times(AnyNumber());
     EXPECT_CALL(visitor_, OnForwardProgressConfirmed()).Times(AnyNumber());
 
     EXPECT_CALL(*loss_algorithm_, GetLossTimeout())
@@ -1956,7 +1956,7 @@
   EXPECT_EQ(kPeerAddress, connection_.effective_peer_address());
 
   EXPECT_CALL(visitor_, OnConnectionMigration(PORT_CHANGE)).Times(0);
-  EXPECT_CALL(visitor_, OnConnectivityProbeReceived(_, _)).Times(0);
+  EXPECT_CALL(visitor_, OnPacketReceived(_, _, false)).Times(0);
 
   // Process a padded PING or PATH CHALLENGE packet with no peer address change
   // on server side will be ignored.
@@ -2076,7 +2076,7 @@
   EXPECT_EQ(kPeerAddress, connection_.effective_peer_address());
 
   EXPECT_CALL(visitor_, OnConnectionMigration(PORT_CHANGE)).Times(0);
-  EXPECT_CALL(visitor_, OnConnectivityProbeReceived(_, _)).Times(1);
+  EXPECT_CALL(visitor_, OnPacketReceived(_, _, true)).Times(1);
 
   // Process a padded PING packet from a new peer address on server side
   // is effectively receiving a connectivity probing.
@@ -2139,7 +2139,7 @@
   QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 4);
 
   EXPECT_CALL(visitor_, OnConnectionMigration(PORT_CHANGE)).Times(0);
-  EXPECT_CALL(visitor_, OnConnectivityProbeReceived(_, _)).Times(1);
+  EXPECT_CALL(visitor_, OnPacketReceived(_, _, true)).Times(1);
 
   // Process a padded PING packet from a new peer address on server side
   // is effectively receiving a connectivity probing, even if a newer packet has
@@ -2192,7 +2192,7 @@
   EXPECT_EQ(kPeerAddress, connection_.effective_peer_address());
 
   EXPECT_CALL(visitor_, OnConnectionMigration(PORT_CHANGE)).Times(0);
-  EXPECT_CALL(visitor_, OnConnectivityProbeReceived(_, _)).Times(1);
+  EXPECT_CALL(visitor_, OnPacketReceived(_, _, true)).Times(1);
 
   // Process a padded PING packet from a new peer address on server side
   // is effectively receiving a connectivity probing.
@@ -2247,7 +2247,7 @@
   // Client takes all padded PING packet as speculative connectivity
   // probing packet, and reports to visitor.
   EXPECT_CALL(visitor_, OnConnectionMigration(PORT_CHANGE)).Times(0);
-  EXPECT_CALL(visitor_, OnConnectivityProbeReceived(_, _)).Times(1);
+  EXPECT_CALL(visitor_, OnPacketReceived(_, _, false)).Times(1);
 
   OwningSerializedPacketPointer probing_packet = ConstructProbingPacket();
   std::unique_ptr<QuicReceivedPacket> received(ConstructReceivedPacket(
@@ -2294,7 +2294,7 @@
   // Process a padded PING packet with a different self address on client side
   // is effectively receiving a connectivity probing.
   EXPECT_CALL(visitor_, OnConnectionMigration(PORT_CHANGE)).Times(0);
-  EXPECT_CALL(visitor_, OnConnectivityProbeReceived(_, _)).Times(1);
+  EXPECT_CALL(visitor_, OnPacketReceived(_, _, true)).Times(1);
 
   const QuicSocketAddress kNewSelfAddress =
       QuicSocketAddress(QuicIpAddress::Loopback6(), /*port=*/23456);
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index ac4ac9b..a9858d8 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -447,10 +447,10 @@
   GetMutableCryptoStream()->OnSuccessfulVersionNegotiation(version);
 }
 
-void QuicSession::OnConnectivityProbeReceived(
-    const QuicSocketAddress& /*self_address*/,
-    const QuicSocketAddress& peer_address) {
-  if (perspective() == Perspective::IS_SERVER) {
+void QuicSession::OnPacketReceived(const QuicSocketAddress& /*self_address*/,
+                                   const QuicSocketAddress& peer_address,
+                                   bool is_connectivity_probe) {
+  if (is_connectivity_probe && perspective() == Perspective::IS_SERVER) {
     // Server only sends back a connectivity probe after received a
     // connectivity probe from a new peer address.
     connection_->SendConnectivityProbingResponsePacket(peer_address);
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h
index cbfff08..4e7afea 100644
--- a/quic/core/quic_session.h
+++ b/quic/core/quic_session.h
@@ -110,9 +110,9 @@
   void OnWriteBlocked() override;
   void OnSuccessfulVersionNegotiation(
       const ParsedQuicVersion& version) override;
-  void OnConnectivityProbeReceived(
-      const QuicSocketAddress& self_address,
-      const QuicSocketAddress& peer_address) override;
+  void OnPacketReceived(const QuicSocketAddress& self_address,
+                        const QuicSocketAddress& peer_address,
+                        bool is_connectivity_probe) override;
   void OnCanWrite() override;
   bool SendProbingData() override;
   void OnCongestionWindowChange(QuicTime /*now*/) override {}
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc
index 9bb4a99..9111ee4 100644
--- a/quic/core/quic_session_test.cc
+++ b/quic/core/quic_session_test.cc
@@ -1317,8 +1317,8 @@
     connection_->OnPathChallengeFrame(
         QuicPathChallengeFrame(0, path_frame_buffer1_));
   }
-  session_.OnConnectivityProbeReceived(session_.self_address(),
-                                       new_peer_address);
+  session_.OnPacketReceived(session_.self_address(), new_peer_address,
+                            /*is_connectivity_probe=*/true);
   EXPECT_EQ(old_peer_address, session_.peer_address());
 }
 
@@ -1357,8 +1357,8 @@
       QuicPathChallengeFrame(0, path_frame_buffer1_));
   connection_->OnPathChallengeFrame(
       QuicPathChallengeFrame(0, path_frame_buffer2_));
-  session_.OnConnectivityProbeReceived(session_.self_address(),
-                                       old_peer_address);
+  session_.OnPacketReceived(session_.self_address(), old_peer_address,
+                            /*is_connectivity_probe=*/true);
 }
 
 TEST_P(QuicSessionTestServer, IncreasedTimeoutAfterCryptoHandshake) {
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h
index 84374ea..40b8036 100644
--- a/quic/test_tools/quic_test_utils.h
+++ b/quic/test_tools/quic_test_utils.h
@@ -382,9 +382,10 @@
   MOCK_CONST_METHOD0(ShouldKeepConnectionAlive, bool());
   MOCK_METHOD1(OnSuccessfulVersionNegotiation,
                void(const ParsedQuicVersion& version));
-  MOCK_METHOD2(OnConnectivityProbeReceived,
+  MOCK_METHOD3(OnPacketReceived,
                void(const QuicSocketAddress& self_address,
-                    const QuicSocketAddress& peer_address));
+                    const QuicSocketAddress& peer_address,
+                    bool is_connectivity_probe));
   MOCK_METHOD0(OnConfigNegotiated, void());
   MOCK_METHOD0(OnAckNeedsRetransmittableFrame, void());
   MOCK_METHOD0(SendPing, void());
diff --git a/quic/test_tools/simulator/quic_endpoint.h b/quic/test_tools/simulator/quic_endpoint.h
index 7481ddc..43fce53 100644
--- a/quic/test_tools/simulator/quic_endpoint.h
+++ b/quic/test_tools/simulator/quic_endpoint.h
@@ -97,9 +97,9 @@
   void OnWriteBlocked() override {}
   void OnSuccessfulVersionNegotiation(
       const ParsedQuicVersion& /*version*/) override {}
-  void OnConnectivityProbeReceived(
-      const QuicSocketAddress& /*self_address*/,
-      const QuicSocketAddress& /*peer_address*/) override {}
+  void OnPacketReceived(const QuicSocketAddress& /*self_address*/,
+                        const QuicSocketAddress& /*peer_address*/,
+                        bool /*is_connectivity_probe*/) override {}
   void OnCongestionWindowChange(QuicTime /*now*/) override {}
   void OnConnectionMigration(AddressChangeType /*type*/) override {}
   void OnPathDegrading() override {}