Commit 4fd11f92 authored by Bin Wu's avatar Bin Wu Committed by Commit Bot

Do not migrate proxied connections for connectivity probing packets. Protected...

Do not migrate proxied connections for connectivity probing packets. Protected by existing flag FLAGS_quic_reloadable_flag_quic_enable_server_proxy.

Merge internal change: 191428948

R=rch@chromium.org

Change-Id: Ide8207871b8a31465cec09439e1f9e67a4366542
Reviewed-on: https://chromium-review.googlesource.com/995613Reviewed-by: default avatarRyan Hamilton <rch@chromium.org>
Commit-Queue: Bin Wu <wub@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548098}
parent 3404205b
...@@ -747,6 +747,7 @@ bool QuicConnection::OnPacketHeader(const QuicPacketHeader& header) { ...@@ -747,6 +747,7 @@ bool QuicConnection::OnPacketHeader(const QuicPacketHeader& header) {
// Initialize the current packet content stats. // Initialize the current packet content stats.
current_packet_content_ = NO_FRAMES_RECEIVED; current_packet_content_ = NO_FRAMES_RECEIVED;
is_current_packet_connectivity_probing_ = false;
if (!enable_server_proxy_) { if (!enable_server_proxy_) {
current_peer_migration_type_ = NO_CHANGE; current_peer_migration_type_ = NO_CHANGE;
...@@ -3022,6 +3023,10 @@ void QuicConnection::OnConnectionMigration(AddressChangeType addr_change_type) { ...@@ -3022,6 +3023,10 @@ void QuicConnection::OnConnectionMigration(AddressChangeType addr_change_type) {
} }
bool QuicConnection::IsCurrentPacketConnectivityProbing() const { bool QuicConnection::IsCurrentPacketConnectivityProbing() const {
if (enable_server_proxy_) {
return is_current_packet_connectivity_probing_;
}
if (current_packet_content_ != SECOND_FRAME_IS_PADDING) { if (current_packet_content_ != SECOND_FRAME_IS_PADDING) {
return false; return false;
} }
...@@ -3133,6 +3138,16 @@ void QuicConnection::UpdatePacketContent(PacketContent type) { ...@@ -3133,6 +3138,16 @@ void QuicConnection::UpdatePacketContent(PacketContent type) {
if (type == SECOND_FRAME_IS_PADDING) { if (type == SECOND_FRAME_IS_PADDING) {
if (current_packet_content_ == FIRST_FRAME_IS_PING) { if (current_packet_content_ == FIRST_FRAME_IS_PING) {
current_packet_content_ = SECOND_FRAME_IS_PADDING; current_packet_content_ = SECOND_FRAME_IS_PADDING;
if (enable_server_proxy_) {
if (perspective_ == Perspective::IS_SERVER) {
is_current_packet_connectivity_probing_ =
current_effective_peer_migration_type_ != NO_CHANGE;
} else {
is_current_packet_connectivity_probing_ =
(last_packet_source_address_ != peer_address_) ||
(last_packet_destination_address_ != self_address_);
}
}
return; return;
} }
} }
......
...@@ -993,6 +993,11 @@ class QUIC_EXPORT_PRIVATE QuicConnection ...@@ -993,6 +993,11 @@ class QUIC_EXPORT_PRIVATE QuicConnection
// Contents received in the current packet, especially used to identify // Contents received in the current packet, especially used to identify
// whether the current packet is a padded PING packet. // whether the current packet is a padded PING packet.
PacketContent current_packet_content_; PacketContent current_packet_content_;
// True if the packet currently being processed is a connectivity probing
// packet. Is set to false when a new packet is received, and will be set to
// true as soon as |current_packet_content_| is set to
// SECOND_FRAME_IS_PADDING.
bool is_current_packet_connectivity_probing_;
// Caches the current peer migration type if a peer migration might be // Caches the current peer migration type if a peer migration might be
// initiated. As soon as the current packet is confirmed not a connectivity // initiated. As soon as the current packet is confirmed not a connectivity
// probe, peer migration will start. // probe, peer migration will start.
......
...@@ -682,6 +682,7 @@ class TestConnection : public QuicConnection { ...@@ -682,6 +682,7 @@ class TestConnection : public QuicConnection {
next_effective_peer_addr_ = QuicMakeUnique<QuicSocketAddress>(addr); next_effective_peer_addr_ = QuicMakeUnique<QuicSocketAddress>(addr);
} }
using QuicConnection::IsCurrentPacketConnectivityProbing;
using QuicConnection::SelectMutualVersion; using QuicConnection::SelectMutualVersion;
using QuicConnection::SendProbingRetransmissions; using QuicConnection::SendProbingRetransmissions;
using QuicConnection::set_defer_send_in_response_to_packets; using QuicConnection::set_defer_send_in_response_to_packets;
...@@ -1477,6 +1478,8 @@ TEST_P(QuicConnectionTest, ReceivePaddedPingAtServer) { ...@@ -1477,6 +1478,8 @@ TEST_P(QuicConnectionTest, ReceivePaddedPingAtServer) {
clock_.Now())); clock_.Now()));
ProcessReceivedPacket(kSelfAddress, kPeerAddress, *received); ProcessReceivedPacket(kSelfAddress, kPeerAddress, *received);
EXPECT_FALSE(connection_.IsCurrentPacketConnectivityProbing());
EXPECT_EQ(kPeerAddress, connection_.peer_address()); EXPECT_EQ(kPeerAddress, connection_.peer_address());
if (GetQuicReloadableFlag(quic_enable_server_proxy)) { if (GetQuicReloadableFlag(quic_enable_server_proxy)) {
EXPECT_EQ(kPeerAddress, connection_.effective_peer_address()); EXPECT_EQ(kPeerAddress, connection_.effective_peer_address());
...@@ -1594,6 +1597,8 @@ TEST_P(QuicConnectionTest, ReceiveConnectivityProbingAtServer) { ...@@ -1594,6 +1597,8 @@ TEST_P(QuicConnectionTest, ReceiveConnectivityProbingAtServer) {
clock_.Now())); clock_.Now()));
ProcessReceivedPacket(kSelfAddress, kNewPeerAddress, *received); ProcessReceivedPacket(kSelfAddress, kNewPeerAddress, *received);
EXPECT_TRUE(connection_.IsCurrentPacketConnectivityProbing());
EXPECT_EQ(kPeerAddress, connection_.peer_address()); EXPECT_EQ(kPeerAddress, connection_.peer_address());
if (GetQuicReloadableFlag(quic_enable_server_proxy)) { if (GetQuicReloadableFlag(quic_enable_server_proxy)) {
EXPECT_EQ(kPeerAddress, connection_.effective_peer_address()); EXPECT_EQ(kPeerAddress, connection_.effective_peer_address());
...@@ -1714,6 +1719,7 @@ TEST_P(QuicConnectionTest, ReceivePaddedPingAtClient) { ...@@ -1714,6 +1719,7 @@ TEST_P(QuicConnectionTest, ReceivePaddedPingAtClient) {
clock_.Now())); clock_.Now()));
ProcessReceivedPacket(kSelfAddress, kPeerAddress, *received); ProcessReceivedPacket(kSelfAddress, kPeerAddress, *received);
EXPECT_FALSE(connection_.IsCurrentPacketConnectivityProbing());
EXPECT_EQ(kPeerAddress, connection_.peer_address()); EXPECT_EQ(kPeerAddress, connection_.peer_address());
if (GetQuicReloadableFlag(quic_enable_server_proxy)) { if (GetQuicReloadableFlag(quic_enable_server_proxy)) {
EXPECT_EQ(kPeerAddress, connection_.effective_peer_address()); EXPECT_EQ(kPeerAddress, connection_.effective_peer_address());
...@@ -1765,6 +1771,7 @@ TEST_P(QuicConnectionTest, ReceiveConnectivityProbingAtClient) { ...@@ -1765,6 +1771,7 @@ TEST_P(QuicConnectionTest, ReceiveConnectivityProbingAtClient) {
clock_.Now())); clock_.Now()));
ProcessReceivedPacket(kNewSelfAddress, kPeerAddress, *received); ProcessReceivedPacket(kNewSelfAddress, kPeerAddress, *received);
EXPECT_TRUE(connection_.IsCurrentPacketConnectivityProbing());
EXPECT_EQ(kPeerAddress, connection_.peer_address()); EXPECT_EQ(kPeerAddress, connection_.peer_address());
if (GetQuicReloadableFlag(quic_enable_server_proxy)) { if (GetQuicReloadableFlag(quic_enable_server_proxy)) {
EXPECT_EQ(kPeerAddress, connection_.effective_peer_address()); EXPECT_EQ(kPeerAddress, connection_.effective_peer_address());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment