From ce7bb141d5359dfe1224a85bafa802a09f1e683d Mon Sep 17 00:00:00 2001 From: "rtenneti@chromium.org" Date: Sat, 17 May 2014 15:51:33 +0000 Subject: Land Recent QUIC Changes. Stub for BBRv2, based on TCP congestion feedback frames. Merge internal change: 67154078 https://codereview.chromium.org/283333008/ Update QuicSentPacketManager to sample a new recent min rtt within the first 2 rtt samples after quiescence. Merge internal change: 67149500 https://codereview.chromium.org/286143007/ Change the test QUIC stream id to be the first non reserved stream ID (and also to use the right typedef). Merge internal change: 67146383 https://codereview.chromium.org/292453003/ Adds dynamic FEC on/off switch in packet creator. Tightens use of max_packets_per_fec_group through use of a setter method across the QUIC code. FEC operations are now decided based on should_fec_protect_, which is expected to be a dynamic on/off control in the packet creator, instead of max_packets_per_fec_group. Adds dynamic FEC on/off switch in packet_creator. Merge internal change: 67144415 https://codereview.chromium.org/286153003/ Minor cleanup to simplify QuicSentPacketManager's OnPacketSent and always reset the retransmission alarm anytime a new pending packet is sent. Always setting the retransmission alarm is only a simplification of the approach, and not intended to fix any issues. Merge internal change: 67143274 https://codereview.chromium.org/288333002/ Don't set QUIC's write alarm if we are connection flow control blocked. Added QUIC_VERSION_19 to kSupportedQuicVersions. Merge internal change: 67141668 https://codereview.chromium.org/285193006/ Minor cleanup of QuicUnackedPacketMap to simplify the implementation of HasPendingPackets and move a test only method, GetNumRetransmittablePackets, into QuicSentPacketManagerPeer. Merge internal change: 67123054 https://codereview.chromium.org/282323003/ Fix a QUIC bug where a crypto packet was never removed from the UnackedPacketMap if it was not acked and spuriously retransmitted at least twice. Merge internal change: 67050631 https://codereview.chromium.org/284273002/ Refactor: move flow controller from QuicConnection to QuicSession. No behavior change intended. Merge internal change: 67036889 https://codereview.chromium.org/286213002/ Fix a QUIC bug where a packet could remain in the UnackedPacketMap indefinitely. This can cause a memory leak when tracking entropy. Merge internal change: 67028206 https://codereview.chromium.org/285233006/ Delete dead code used only in tests. Merge internal change: 66938996 https://codereview.chromium.org/288303002/ Add handling + parsing for ALTSVC frame. Also change frame type number and add an extra version check for BLOCKED frame. SPDY4/HTTP2 only. Merge internal change: 66925490 https://codereview.chromium.org/286173002/ QUIC loadtest fixes: - Wait for the QUIC handshake to complete before saying that the QuicTestClient is connected. - Force connect at client creation time when talking HTTP/HTTPS/SPDY for consistency. Merge internal change: 66855236 https://codereview.chromium.org/282153004/ QUIC now respects configured SPDY stream limits. Merge internal change: 66831620 https://codereview.chromium.org/286113004/ R=rch@chromium.org Review URL: https://codereview.chromium.org/288313003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271211 0039d316-1c4b-4281-b951-d872f2087c98 --- net/tools/quic/end_to_end_test.cc | 7 ++++++- net/tools/quic/quic_client.cc | 9 +++++---- net/tools/quic/quic_client_session.cc | 5 ++++- net/tools/quic/quic_client_session.h | 1 + net/tools/quic/quic_client_session_test.cc | 2 ++ net/tools/quic/quic_dispatcher.cc | 19 ++++++++----------- net/tools/quic/quic_dispatcher.h | 3 +-- net/tools/quic/quic_dispatcher_test.cc | 8 ++++---- net/tools/quic/quic_server_session.cc | 10 +++++----- net/tools/quic/quic_server_session.h | 1 + net/tools/quic/quic_server_session_test.cc | 2 +- net/tools/quic/quic_spdy_client_stream_test.cc | 1 + net/tools/quic/test_tools/quic_dispatcher_peer.cc | 6 ++---- net/tools/quic/test_tools/quic_dispatcher_peer.h | 3 +-- net/tools/quic/test_tools/quic_test_utils.cc | 23 ++++++++++------------- 15 files changed, 52 insertions(+), 48 deletions(-) (limited to 'net/tools') diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc index cf56826..8d04535 100644 --- a/net/tools/quic/end_to_end_test.cc +++ b/net/tools/quic/end_to_end_test.cc @@ -24,6 +24,7 @@ #include "net/quic/quic_sent_packet_manager.h" #include "net/quic/quic_server_id.h" #include "net/quic/test_tools/quic_connection_peer.h" +#include "net/quic/test_tools/quic_packet_creator_peer.h" #include "net/quic/test_tools/quic_session_peer.h" #include "net/quic/test_tools/quic_test_utils.h" #include "net/quic/test_tools/reliable_quic_stream_peer.h" @@ -50,6 +51,7 @@ using base::WaitableEvent; using net::EpollServer; using net::test::GenerateBody; using net::test::QuicConnectionPeer; +using net::test::QuicPacketCreatorPeer; using net::test::QuicSessionPeer; using net::test::ReliableQuicStreamPeer; using net::tools::test::PacketDroppingTestWriter; @@ -644,7 +646,10 @@ TEST_P(EndToEndTest, LargePostFEC) { client_->client()->WaitForCryptoHandshakeConfirmed(); SetPacketLossPercentage(30); - client_->options()->max_packets_per_fec_group = 6; + // Turn on FEC protection. + QuicPacketCreator* creator = QuicConnectionPeer::GetPacketCreator( + client_->client()->session()->connection()); + EXPECT_TRUE(QuicPacketCreatorPeer::SwitchFecProtectionOn(creator, 6)); string body; GenerateBody(&body, 10240); diff --git a/net/tools/quic/quic_client.cc b/net/tools/quic/quic_client.cc index cb2b408..6935238 100644 --- a/net/tools/quic/quic_client.cc +++ b/net/tools/quic/quic_client.cc @@ -189,8 +189,8 @@ bool QuicClient::StartConnect() { server_id_, config_, new QuicConnection(GenerateConnectionId(), server_address_, helper_.get(), - writer_.get(), false, supported_versions_, - initial_flow_control_window_), + writer_.get(), false, supported_versions_), + initial_flow_control_window_, &crypto_config_)); return session_->CryptoConnect(); } @@ -218,6 +218,7 @@ void QuicClient::SendRequestsAndWaitForResponse( BalsaHeaders headers; headers.SetRequestFirstlineFromStringPieces("GET", args[i], "HTTP/1.1"); QuicSpdyClientStream* stream = CreateReliableClientStream(); + DCHECK(stream != NULL); stream->SendRequest(headers, "", true); stream->set_visitor(this); } @@ -236,7 +237,7 @@ QuicSpdyClientStream* QuicClient::CreateReliableClientStream() { void QuicClient::WaitForStreamToClose(QuicStreamId id) { DCHECK(connected()); - while (!session_->IsClosedStream(id)) { + while (connected() && !session_->IsClosedStream(id)) { epoll_server_.WaitForEventsAndExecuteCallbacks(); } } @@ -244,7 +245,7 @@ void QuicClient::WaitForStreamToClose(QuicStreamId id) { void QuicClient::WaitForCryptoHandshakeConfirmed() { DCHECK(connected()); - while (!session_->IsCryptoHandshakeConfirmed()) { + while (connected() && !session_->IsCryptoHandshakeConfirmed()) { epoll_server_.WaitForEventsAndExecuteCallbacks(); } } diff --git a/net/tools/quic/quic_client_session.cc b/net/tools/quic/quic_client_session.cc index aca5418..c8e28db 100644 --- a/net/tools/quic/quic_client_session.cc +++ b/net/tools/quic/quic_client_session.cc @@ -18,8 +18,11 @@ QuicClientSession::QuicClientSession( const QuicServerId& server_id, const QuicConfig& config, QuicConnection* connection, + uint32 max_flow_control_receive_window_bytes, QuicCryptoClientConfig* crypto_config) - : QuicClientSessionBase(connection, config), + : QuicClientSessionBase(connection, + max_flow_control_receive_window_bytes, + config), crypto_stream_(server_id, this, NULL, crypto_config) { } diff --git a/net/tools/quic/quic_client_session.h b/net/tools/quic/quic_client_session.h index 3aad445..d04b420 100644 --- a/net/tools/quic/quic_client_session.h +++ b/net/tools/quic/quic_client_session.h @@ -28,6 +28,7 @@ class QuicClientSession : public QuicClientSessionBase { QuicClientSession(const QuicServerId& server_id, const QuicConfig& config, QuicConnection* connection, + uint32 max_flow_control_receive_window_bytes, QuicCryptoClientConfig* crypto_config); virtual ~QuicClientSession(); diff --git a/net/tools/quic/quic_client_session_test.cc b/net/tools/quic/quic_client_session_test.cc index 7b50f42..983106d 100644 --- a/net/tools/quic/quic_client_session_test.cc +++ b/net/tools/quic/quic_client_session_test.cc @@ -15,6 +15,7 @@ using net::test::CryptoTestUtils; using net::test::DefaultQuicConfig; +using net::test::kInitialFlowControlWindowForTest; using net::test::PacketSavingConnection; using net::test::SupportedVersions; using testing::_; @@ -38,6 +39,7 @@ class ToolsQuicClientSessionTest QuicServerId(kServerHostname, kPort, false, PRIVACY_MODE_DISABLED), DefaultQuicConfig(), connection_, + kInitialFlowControlWindowForTest, &crypto_config_)); session_->config()->SetDefaults(); } diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc index b074a5d..df9b9c6 100644 --- a/net/tools/quic/quic_dispatcher.cc +++ b/net/tools/quic/quic_dispatcher.cc @@ -382,8 +382,8 @@ QuicSession* QuicDispatcher::CreateQuicSession( config_, CreateQuicConnection(connection_id, server_address, - client_address, - initial_flow_control_window_bytes_), + client_address), + initial_flow_control_window_bytes_, this); session->InitializeSession(crypto_config_); return session; @@ -392,14 +392,12 @@ QuicSession* QuicDispatcher::CreateQuicSession( QuicConnection* QuicDispatcher::CreateQuicConnection( QuicConnectionId connection_id, const IPEndPoint& server_address, - const IPEndPoint& client_address, - uint32 initial_flow_control_window) { + const IPEndPoint& client_address) { if (FLAGS_enable_quic_stream_flow_control_2 && FLAGS_enable_quic_connection_flow_control) { DLOG(INFO) << "Creating QuicDispatcher with all versions."; return new QuicConnection(connection_id, client_address, helper_.get(), - writer_.get(), true, supported_versions_, - initial_flow_control_window_bytes_); + writer_.get(), true, supported_versions_); } if (FLAGS_enable_quic_stream_flow_control_2 && @@ -408,15 +406,14 @@ QuicConnection* QuicDispatcher::CreateQuicConnection( << "WITHOUT version 19 or higher."; return new QuicConnection(connection_id, client_address, helper_.get(), writer_.get(), true, - supported_versions_no_connection_flow_control_, - initial_flow_control_window_bytes_); + supported_versions_no_connection_flow_control_); } DLOG(INFO) << "Flow control disabled, creating QuicDispatcher WITHOUT " << "version 17 or higher."; - return new QuicConnection( - connection_id, client_address, helper_.get(), writer_.get(), true, - supported_versions_no_flow_control_, initial_flow_control_window_bytes_); + return new QuicConnection(connection_id, client_address, helper_.get(), + writer_.get(), true, + supported_versions_no_flow_control_); } QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { diff --git a/net/tools/quic/quic_dispatcher.h b/net/tools/quic/quic_dispatcher.h index fbb2f40..b19d5c5 100644 --- a/net/tools/quic/quic_dispatcher.h +++ b/net/tools/quic/quic_dispatcher.h @@ -113,8 +113,7 @@ class QuicDispatcher : public QuicServerSessionVisitor { virtual QuicConnection* CreateQuicConnection( QuicConnectionId connection_id, const IPEndPoint& server_address, - const IPEndPoint& client_address, - uint32 initial_flow_control_window); + const IPEndPoint& client_address); // Called by |framer_visitor_| when the public header has been parsed. virtual bool OnUnauthenticatedPublicHeader( diff --git a/net/tools/quic/quic_dispatcher_test.cc b/net/tools/quic/quic_dispatcher_test.cc index db8b76a..bd0d204 100644 --- a/net/tools/quic/quic_dispatcher_test.cc +++ b/net/tools/quic/quic_dispatcher_test.cc @@ -290,16 +290,16 @@ TEST(QuicDispatcherFlowControlTest, NoNewVersion17ConnectionsIfFlagDisabled) { // When flag is enabled, new connections should support QUIC_VERSION_17. FLAGS_enable_quic_stream_flow_control_2 = true; scoped_ptr connection_1( - QuicDispatcherPeer::CreateQuicConnection( - &dispatcher, kCID, client, server, kInitialFlowControlWindowForTest)); + QuicDispatcherPeer::CreateQuicConnection(&dispatcher, kCID, client, + server)); EXPECT_EQ(QUIC_VERSION_17, connection_1->version()); // When flag is disabled, new connections should not support QUIC_VERSION_17. FLAGS_enable_quic_stream_flow_control_2 = false; scoped_ptr connection_2( - QuicDispatcherPeer::CreateQuicConnection( - &dispatcher, kCID, client, server, kInitialFlowControlWindowForTest)); + QuicDispatcherPeer::CreateQuicConnection(&dispatcher, kCID, client, + server)); EXPECT_EQ(QUIC_VERSION_16, connection_2->version()); } diff --git a/net/tools/quic/quic_server_session.cc b/net/tools/quic/quic_server_session.cc index 2fc824d..7c31ef0 100644 --- a/net/tools/quic/quic_server_session.cc +++ b/net/tools/quic/quic_server_session.cc @@ -12,11 +12,11 @@ namespace net { namespace tools { -QuicServerSession::QuicServerSession( - const QuicConfig& config, - QuicConnection* connection, - QuicServerSessionVisitor* visitor) - : QuicSession(connection, config), +QuicServerSession::QuicServerSession(const QuicConfig& config, + QuicConnection* connection, + uint32 max_flow_control_window_bytes, + QuicServerSessionVisitor* visitor) + : QuicSession(connection, max_flow_control_window_bytes, config), visitor_(visitor) {} QuicServerSession::~QuicServerSession() {} diff --git a/net/tools/quic/quic_server_session.h b/net/tools/quic/quic_server_session.h index ffd8b0a..41d7305 100644 --- a/net/tools/quic/quic_server_session.h +++ b/net/tools/quic/quic_server_session.h @@ -47,6 +47,7 @@ class QuicServerSession : public QuicSession { public: QuicServerSession(const QuicConfig& config, QuicConnection *connection, + uint32 max_flow_control_window_bytes, QuicServerSessionVisitor* visitor); // Override the base class to notify the owner of the connection close. diff --git a/net/tools/quic/quic_server_session_test.cc b/net/tools/quic/quic_server_session_test.cc index 22308fb..0d9c816 100644 --- a/net/tools/quic/quic_server_session_test.cc +++ b/net/tools/quic/quic_server_session_test.cc @@ -53,7 +53,7 @@ class QuicServerSessionTest : public ::testing::TestWithParam { connection_ = new StrictMock(true, SupportedVersions(GetParam())); session_.reset(new QuicServerSession( - config_, connection_, &owner_)); + config_, connection_, kInitialFlowControlWindowForTest, &owner_)); session_->InitializeSession(crypto_config_); visitor_ = QuicConnectionPeer::GetVisitor(connection_); } diff --git a/net/tools/quic/quic_spdy_client_stream_test.cc b/net/tools/quic/quic_spdy_client_stream_test.cc index 67f9d89..98ca650 100644 --- a/net/tools/quic/quic_spdy_client_stream_test.cc +++ b/net/tools/quic/quic_spdy_client_stream_test.cc @@ -33,6 +33,7 @@ class QuicSpdyClientStreamTest : public TestWithParam { session_(QuicServerId("example.com", 80, false, PRIVACY_MODE_DISABLED), DefaultQuicConfig(), connection_, + kInitialFlowControlWindowForTest, &crypto_config_), body_("hello world") { crypto_config_.SetDefaults(); diff --git a/net/tools/quic/test_tools/quic_dispatcher_peer.cc b/net/tools/quic/test_tools/quic_dispatcher_peer.cc index 0622881..cd27802 100644 --- a/net/tools/quic/test_tools/quic_dispatcher_peer.cc +++ b/net/tools/quic/test_tools/quic_dispatcher_peer.cc @@ -41,12 +41,10 @@ QuicConnection* QuicDispatcherPeer::CreateQuicConnection( QuicDispatcher* dispatcher, QuicConnectionId connection_id, const IPEndPoint& server, - const IPEndPoint& client, - uint32 initial_flow_control_window_bytes) { + const IPEndPoint& client) { return dispatcher->CreateQuicConnection(connection_id, server, - client, - initial_flow_control_window_bytes); + client); } } // namespace test diff --git a/net/tools/quic/test_tools/quic_dispatcher_peer.h b/net/tools/quic/test_tools/quic_dispatcher_peer.h index e647820..45125c2 100644 --- a/net/tools/quic/test_tools/quic_dispatcher_peer.h +++ b/net/tools/quic/test_tools/quic_dispatcher_peer.h @@ -34,8 +34,7 @@ class QuicDispatcherPeer { QuicDispatcher* dispatcher, QuicConnectionId connection_id, const IPEndPoint& server, - const IPEndPoint& client, - uint32 initial_flow_control_window_bytes); + const IPEndPoint& client); private: DISALLOW_COPY_AND_ASSIGN(QuicDispatcherPeer); diff --git a/net/tools/quic/test_tools/quic_test_utils.cc b/net/tools/quic/test_tools/quic_test_utils.cc index 78e67ca..bbb03d3 100644 --- a/net/tools/quic/test_tools/quic_test_utils.cc +++ b/net/tools/quic/test_tools/quic_test_utils.cc @@ -13,6 +13,7 @@ using base::StringPiece; using net::test::kInitialFlowControlWindowForTest; using net::test::MockHelper; +using net::test::QuicConnectionPeer; namespace net { namespace tools { @@ -23,9 +24,8 @@ MockConnection::MockConnection(bool is_server) IPEndPoint(net::test::Loopback4(), kTestPort), new testing::NiceMock(), new testing::NiceMock(), - is_server, QuicSupportedVersions(), - kInitialFlowControlWindowForTest), - writer_(net::test::QuicConnectionPeer::GetWriter(this)), + is_server, QuicSupportedVersions()), + writer_(QuicConnectionPeer::GetWriter(this)), helper_(helper()) { } @@ -34,9 +34,8 @@ MockConnection::MockConnection(IPEndPoint address, : QuicConnection(kTestConnectionId, address, new testing::NiceMock(), new testing::NiceMock(), - is_server, QuicSupportedVersions(), - kInitialFlowControlWindowForTest), - writer_(net::test::QuicConnectionPeer::GetWriter(this)), + is_server, QuicSupportedVersions()), + writer_(QuicConnectionPeer::GetWriter(this)), helper_(helper()) { } @@ -46,9 +45,8 @@ MockConnection::MockConnection(QuicConnectionId connection_id, IPEndPoint(net::test::Loopback4(), kTestPort), new testing::NiceMock(), new testing::NiceMock(), - is_server, QuicSupportedVersions(), - kInitialFlowControlWindowForTest), - writer_(net::test::QuicConnectionPeer::GetWriter(this)), + is_server, QuicSupportedVersions()), + writer_(QuicConnectionPeer::GetWriter(this)), helper_(helper()) { } @@ -58,9 +56,8 @@ MockConnection::MockConnection(bool is_server, IPEndPoint(net::test::Loopback4(), kTestPort), new testing::NiceMock(), new testing::NiceMock(), - is_server, QuicSupportedVersions(), - kInitialFlowControlWindowForTest), - writer_(net::test::QuicConnectionPeer::GetWriter(this)), + is_server, QuicSupportedVersions()), + writer_(QuicConnectionPeer::GetWriter(this)), helper_(helper()) { } @@ -81,7 +78,7 @@ uint64 SimpleRandom::RandUint64() { TestSession::TestSession(QuicConnection* connection, const QuicConfig& config) - : QuicSession(connection, config), + : QuicSession(connection, kInitialFlowControlWindowForTest, config), crypto_stream_(NULL) { } -- cgit v1.1