diff options
Diffstat (limited to 'net/tools/quic')
| -rw-r--r-- | net/tools/quic/end_to_end_test.cc | 7 | ||||
| -rw-r--r-- | net/tools/quic/quic_client.cc | 9 | ||||
| -rw-r--r-- | net/tools/quic/quic_client_session.cc | 5 | ||||
| -rw-r--r-- | net/tools/quic/quic_client_session.h | 1 | ||||
| -rw-r--r-- | net/tools/quic/quic_client_session_test.cc | 2 | ||||
| -rw-r--r-- | net/tools/quic/quic_dispatcher.cc | 19 | ||||
| -rw-r--r-- | net/tools/quic/quic_dispatcher.h | 3 | ||||
| -rw-r--r-- | net/tools/quic/quic_dispatcher_test.cc | 8 | ||||
| -rw-r--r-- | net/tools/quic/quic_server_session.cc | 10 | ||||
| -rw-r--r-- | net/tools/quic/quic_server_session.h | 1 | ||||
| -rw-r--r-- | net/tools/quic/quic_server_session_test.cc | 2 | ||||
| -rw-r--r-- | net/tools/quic/quic_spdy_client_stream_test.cc | 1 | ||||
| -rw-r--r-- | net/tools/quic/test_tools/quic_dispatcher_peer.cc | 6 | ||||
| -rw-r--r-- | net/tools/quic/test_tools/quic_dispatcher_peer.h | 3 | ||||
| -rw-r--r-- | net/tools/quic/test_tools/quic_test_utils.cc | 23 |
15 files changed, 52 insertions, 48 deletions
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<QuicConnection> 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<QuicConnection> 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<QuicVersion> { connection_ = new StrictMock<MockConnection>(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<QuicVersion> { 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<MockHelper>(), new testing::NiceMock<MockPacketWriter>(), - 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<MockHelper>(), new testing::NiceMock<MockPacketWriter>(), - 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<MockHelper>(), new testing::NiceMock<MockPacketWriter>(), - 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<MockHelper>(), new testing::NiceMock<MockPacketWriter>(), - 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) { } |
