diff options
author | jdorfman <jdorfman@google.com> | 2016-01-15 05:22:47 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-15 13:23:41 +0000 |
commit | 90d185f3cff314a1dce57093602565bc5b8c1432 (patch) | |
tree | 4bc08cea347fc190b8c986c9f9a8be4a14b5475e | |
parent | 39b29672f4106a3abd636c2c7b1728291e085f29 (diff) | |
download | chromium_src-90d185f3cff314a1dce57093602565bc5b8c1432.zip chromium_src-90d185f3cff314a1dce57093602565bc5b8c1432.tar.gz chromium_src-90d185f3cff314a1dce57093602565bc5b8c1432.tar.bz2 |
Remove QuicConnection::PacketWriterFactory and QuicDispatcher::PacketWriterFactory and pass/construct QuicPacketWriter*'s directly. No functional change. Not flag protected.
This is a small step towards removing QuicPerConnectionPacketWriter.
BUG=
Review URL: https://codereview.chromium.org/1564363002
Cr-Commit-Position: refs/heads/master@{#369730}
30 files changed, 86 insertions, 398 deletions
diff --git a/net/quic/p2p/quic_p2p_session_test.cc b/net/quic/p2p/quic_p2p_session_test.cc index b5f632f..06b62c1 100644 --- a/net/quic/p2p/quic_p2p_session_test.cc +++ b/net/quic/p2p/quic_p2p_session_test.cc @@ -129,22 +129,6 @@ class FakeP2PDatagramSocket : public Socket { base::WeakPtrFactory<FakeP2PDatagramSocket> weak_factory_; }; -class DefaultPacketWriterFactory : public QuicConnection::PacketWriterFactory { - public: - explicit DefaultPacketWriterFactory(Socket* socket) : socket_(socket) {} - ~DefaultPacketWriterFactory() override {} - - QuicPacketWriter* Create(QuicConnection* connection) const override { - scoped_ptr<net::QuicDefaultPacketWriter> writer( - new net::QuicDefaultPacketWriter(socket_)); - writer->SetConnection(connection); - return writer.release(); - } - - private: - Socket* socket_; -}; - class TestP2PStreamDelegate : public QuicP2PStream::Delegate { public: TestP2PStreamDelegate() {} @@ -241,11 +225,13 @@ class QuicP2PSessionTest : public ::testing::Test { scoped_ptr<QuicP2PSession> CreateP2PSession(scoped_ptr<Socket> socket, QuicP2PCryptoConfig crypto_config, Perspective perspective) { - DefaultPacketWriterFactory writer_factory(socket.get()); + net::QuicDefaultPacketWriter* writer = + new net::QuicDefaultPacketWriter(socket.get()); net::IPAddressNumber ip(net::kIPv4AddressSize, 0); scoped_ptr<QuicConnection> quic_connection1(new QuicConnection( - 0, net::IPEndPoint(ip, 0), &quic_helper_, writer_factory, + 0, net::IPEndPoint(ip, 0), &quic_helper_, writer, true /* owns_writer */, perspective, QuicSupportedVersions())); + writer->SetConnection(quic_connection1.get()); scoped_ptr<QuicP2PSession> result( new QuicP2PSession(config_, crypto_config, std::move(quic_connection1), diff --git a/net/quic/quic_chromium_client_session_test.cc b/net/quic/quic_chromium_client_session_test.cc index 356b69a..245843f 100644 --- a/net/quic/quic_chromium_client_session_test.cc +++ b/net/quic/quic_chromium_client_session_test.cc @@ -53,23 +53,6 @@ const char kServerHostname[] = "test.example.com"; const uint16_t kServerPort = 443; const size_t kMaxReadersPerQuicSession = 5; -class DefaultPacketWriterFactory : public QuicConnection::PacketWriterFactory { - public: - explicit DefaultPacketWriterFactory(DatagramClientSocket* socket) - : socket_(socket) {} - ~DefaultPacketWriterFactory() override {} - - QuicPacketWriter* Create(QuicConnection* connection) const override { - scoped_ptr<net::QuicDefaultPacketWriter> writer( - new net::QuicDefaultPacketWriter(socket_)); - writer->SetConnection(connection); - return writer.release(); - } - - private: - DatagramClientSocket* socket_; -}; - class QuicChromiumClientSessionTest : public ::testing::TestWithParam<QuicVersion> { protected: @@ -89,10 +72,12 @@ class QuicChromiumClientSessionTest base::Bind(&base::RandInt), &net_log_, NetLog::Source()); socket->Connect(kIpEndPoint); - DefaultPacketWriterFactory writer_factory(socket.get()); + QuicDefaultPacketWriter* writer = + new net::QuicDefaultPacketWriter(socket.get()); QuicConnection* connection = new QuicConnection( - 0, kIpEndPoint, &helper_, writer_factory, true, Perspective::IS_CLIENT, + 0, kIpEndPoint, &helper_, writer, true, Perspective::IS_CLIENT, SupportedVersions(GetParam())); + writer->SetConnection(connection); session_.reset(new QuicChromiumClientSession( connection, std::move(socket), /*stream_factory=*/nullptr, &crypto_client_stream_factory_, &clock_, @@ -140,7 +125,6 @@ class QuicChromiumClientSessionTest MockClock clock_; MockRandom random_; QuicConnectionHelper helper_; - scoped_ptr<DefaultPacketWriterFactory> writer_factory_; TransportSecurityState transport_security_state_; MockCryptoClientStreamFactory crypto_client_stream_factory_; scoped_ptr<QuicChromiumClientSession> session_; diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc index 13a8be1..df2efe4 100644 --- a/net/quic/quic_connection.cc +++ b/net/quic/quic_connection.cc @@ -237,7 +237,7 @@ class MtuDiscoveryAckListener : public QuicAckListenerInterface { QuicConnection::QuicConnection(QuicConnectionId connection_id, IPEndPoint address, QuicConnectionHelperInterface* helper, - const PacketWriterFactory& writer_factory, + QuicPacketWriter* writer, bool owns_writer, Perspective perspective, const QuicVersionVector& supported_versions) @@ -245,7 +245,7 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id, helper->GetClock()->ApproximateNow(), perspective), helper_(helper), - writer_(writer_factory.Create(this)), + writer_(writer), owns_writer_(owns_writer), encryption_level_(ENCRYPTION_NONE), has_forward_secure_encrypter_(false), diff --git a/net/quic/quic_connection.h b/net/quic/quic_connection.h index 051d109..8a69f77 100644 --- a/net/quic/quic_connection.h +++ b/net/quic/quic_connection.h @@ -281,21 +281,13 @@ class NET_EXPORT_PRIVATE QuicConnection BUNDLE_PENDING_ACK = 2, }; - class PacketWriterFactory { - public: - virtual ~PacketWriterFactory() {} - - virtual QuicPacketWriter* Create(QuicConnection* connection) const = 0; - }; - - // Constructs a new QuicConnection for |connection_id| and |address|. Invokes - // writer_factory->Create() to get a writer; |owns_writer| specifies whether - // the connection takes ownership of the returned writer. |helper| must - // outlive this connection. + // Constructs a new QuicConnection for |connection_id| and |address| using + // |writer| to write packets. |owns_writer| specifies whether the connection + // takes ownership of |writer|. |helper| must outlive this connection. QuicConnection(QuicConnectionId connection_id, IPEndPoint address, QuicConnectionHelperInterface* helper, - const PacketWriterFactory& writer_factory, + QuicPacketWriter* writer, bool owns_writer, Perspective perspective, const QuicVersionVector& supported_versions); diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc index 2f06d71..c29ded9 100644 --- a/net/quic/quic_connection_test.cc +++ b/net/quic/quic_connection_test.cc @@ -413,20 +413,20 @@ class TestConnection : public QuicConnection { TestConnection(QuicConnectionId connection_id, IPEndPoint address, TestConnectionHelper* helper, - const PacketWriterFactory& factory, + TestPacketWriter* writer, Perspective perspective, QuicVersion version) : QuicConnection(connection_id, address, helper, - factory, + writer, /* owns_writer= */ false, perspective, SupportedVersions(version)) { // Disable tail loss probes for most tests. QuicSentPacketManagerPeer::SetMaxTailLossProbes( QuicConnectionPeer::GetSentPacketManager(this), 0); - writer()->set_perspective(perspective); + writer->set_perspective(perspective); } void SendAck() { QuicConnectionPeer::SendAck(this); } @@ -628,16 +628,6 @@ class FecQuicConnectionDebugVisitor : public QuicConnectionDebugVisitor { QuicPacketHeader revived_header_; }; -class MockPacketWriterFactory : public QuicConnection::PacketWriterFactory { - public: - explicit MockPacketWriterFactory(QuicPacketWriter* writer) { - ON_CALL(*this, Create(_)).WillByDefault(Return(writer)); - } - ~MockPacketWriterFactory() override {} - - MOCK_CONST_METHOD1(Create, QuicPacketWriter*(QuicConnection* connection)); -}; - // Run tests with combinations of {QuicVersion, fec_send_policy}. struct TestParams { TestParams(QuicVersion version, FecSendPolicy fec_send_policy) @@ -680,11 +670,10 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> { &buffer_allocator_, /*delegate=*/nullptr), writer_(new TestPacketWriter(version(), &clock_)), - factory_(writer_.get()), connection_(connection_id_, kPeerAddress, helper_.get(), - factory_, + writer_.get(), Perspective::IS_CLIENT, version()), creator_(QuicConnectionPeer::GetPacketCreator(&connection_)), @@ -1106,7 +1095,6 @@ class QuicConnectionTest : public ::testing::TestWithParam<TestParams> { scoped_ptr<TestConnectionHelper> helper_; QuicPacketCreator peer_creator_; scoped_ptr<TestPacketWriter> writer_; - NiceMock<MockPacketWriterFactory> factory_; TestConnection connection_; QuicPacketCreator* creator_; QuicPacketGenerator* generator_; @@ -1137,7 +1125,7 @@ TEST_P(QuicConnectionTest, MaxPacketSize) { TEST_P(QuicConnectionTest, SmallerServerMaxPacketSize) { QuicConnectionId connection_id = 42; TestConnection connection(connection_id, kPeerAddress, helper_.get(), - factory_, Perspective::IS_SERVER, version()); + writer_.get(), Perspective::IS_SERVER, version()); EXPECT_EQ(Perspective::IS_SERVER, connection.perspective()); EXPECT_EQ(1000u, connection.max_packet_length()); } @@ -1223,7 +1211,7 @@ TEST_P(QuicConnectionTest, LimitMaxPacketSizeByWriterForNewConnection) { const QuicByteCount lower_max_packet_size = 1240; writer_->set_max_packet_size(lower_max_packet_size); TestConnection connection(connection_id, kPeerAddress, helper_.get(), - factory_, Perspective::IS_CLIENT, version()); + writer_.get(), Perspective::IS_CLIENT, version()); EXPECT_EQ(Perspective::IS_CLIENT, connection.perspective()); EXPECT_EQ(lower_max_packet_size, connection.max_packet_length()); } @@ -5430,10 +5418,10 @@ TEST_P(QuicConnectionTest, OnPacketHeaderDebugVisitor) { } TEST_P(QuicConnectionTest, Pacing) { - TestConnection server(connection_id_, kSelfAddress, helper_.get(), factory_, - Perspective::IS_SERVER, version()); - TestConnection client(connection_id_, kPeerAddress, helper_.get(), factory_, - Perspective::IS_CLIENT, version()); + TestConnection server(connection_id_, kSelfAddress, helper_.get(), + writer_.get(), Perspective::IS_SERVER, version()); + TestConnection client(connection_id_, kPeerAddress, helper_.get(), + writer_.get(), Perspective::IS_CLIENT, version()); EXPECT_FALSE(client.sent_packet_manager().using_pacing()); EXPECT_FALSE(server.sent_packet_manager().using_pacing()); } diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc index 09da291..e514c03 100644 --- a/net/quic/quic_http_stream_test.cc +++ b/net/quic/quic_http_stream_test.cc @@ -66,11 +66,11 @@ class TestQuicConnection : public QuicConnection { QuicConnectionId connection_id, IPEndPoint address, QuicConnectionHelper* helper, - const QuicConnection::PacketWriterFactory& writer_factory) + QuicPacketWriter* writer) : QuicConnection(connection_id, address, helper, - writer_factory, + writer, true /* owns_writer */, Perspective::IS_CLIENT, versions) {} @@ -96,20 +96,6 @@ class AutoClosingStream : public QuicHttpStream { void OnDataAvailable() override { Close(false); } }; -class TestPacketWriterFactory : public QuicConnection::PacketWriterFactory { - public: - explicit TestPacketWriterFactory(DatagramClientSocket* socket) - : socket_(socket) {} - ~TestPacketWriterFactory() override {} - - QuicPacketWriter* Create(QuicConnection* connection) const override { - return new QuicDefaultPacketWriter(socket_); - } - - private: - DatagramClientSocket* socket_; -}; - } // namespace class QuicHttpStreamPeer { @@ -216,10 +202,9 @@ class QuicHttpStreamTest : public ::testing::TestWithParam<QuicVersion> { EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)).Times(AnyNumber()); helper_.reset( new QuicConnectionHelper(runner_.get(), &clock_, &random_generator_)); - TestPacketWriterFactory writer_factory(socket); - connection_ = - new TestQuicConnection(SupportedVersions(GetParam()), connection_id_, - peer_addr_, helper_.get(), writer_factory); + connection_ = new TestQuicConnection( + SupportedVersions(GetParam()), connection_id_, peer_addr_, + helper_.get(), new QuicDefaultPacketWriter(socket)); connection_->set_visitor(&visitor_); connection_->SetSendAlgorithm(send_algorithm_); session_.reset(new QuicChromiumClientSession( diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index 1eea730..545355c 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc @@ -117,26 +117,6 @@ QuicConfig InitializeQuicConfig(const QuicTagVector& connection_options, return config; } -class DefaultPacketWriterFactory : public QuicConnection::PacketWriterFactory { - public: - explicit DefaultPacketWriterFactory(DatagramClientSocket* socket) - : socket_(socket) {} - ~DefaultPacketWriterFactory() override {} - - QuicPacketWriter* Create(QuicConnection* connection) const override; - - private: - DatagramClientSocket* socket_; -}; - -QuicPacketWriter* DefaultPacketWriterFactory::Create( - QuicConnection* connection) const { - scoped_ptr<QuicDefaultPacketWriter> writer( - new QuicDefaultPacketWriter(socket_)); - writer->SetConnection(connection); - return writer.release(); -} - } // namespace // Responsible for creating a new QUIC session to the specified server, and @@ -1269,9 +1249,8 @@ void QuicStreamFactory::MaybeMigrateOrCloseSessions( scoped_ptr<QuicPacketReader> new_reader(new QuicPacketReader( socket.get(), clock_.get(), session, yield_after_packets_, yield_after_duration_, session->net_log())); - DefaultPacketWriterFactory packet_writer_factory(socket.get()); scoped_ptr<QuicPacketWriter> new_writer( - packet_writer_factory.Create(connection)); + new QuicDefaultPacketWriter(socket.get())); if (!session->MigrateToSocket(std::move(socket), std::move(new_reader), std::move(new_writer))) { @@ -1416,17 +1395,18 @@ int QuicStreamFactory::CreateSession(const QuicServerId& server_id, DCHECK_EQ(0u, port_suggester->call_count()); } - DefaultPacketWriterFactory packet_writer_factory(socket.get()); if (!helper_.get()) { helper_.reset( new QuicConnectionHelper(base::ThreadTaskRunnerHandle::Get().get(), clock_.get(), random_generator_)); } + QuicDefaultPacketWriter* writer = new QuicDefaultPacketWriter(socket.get()); QuicConnectionId connection_id = random_generator_->RandUint64(); QuicConnection* connection = new QuicConnection( - connection_id, addr, helper_.get(), packet_writer_factory, - true /* owns_writer */, Perspective::IS_CLIENT, supported_versions_); + connection_id, addr, helper_.get(), writer, true /* owns_writer */, + Perspective::IS_CLIENT, supported_versions_); + writer->SetConnection(connection); connection->SetMaxPacketLength(max_packet_length_); InitializeCachedStateInCryptoConfig(server_id, server_info); diff --git a/net/quic/test_tools/mock_quic_dispatcher.cc b/net/quic/test_tools/mock_quic_dispatcher.cc index aceb7ff..66b940b 100644 --- a/net/quic/test_tools/mock_quic_dispatcher.cc +++ b/net/quic/test_tools/mock_quic_dispatcher.cc @@ -12,12 +12,10 @@ namespace test { MockQuicDispatcher::MockQuicDispatcher( const QuicConfig& config, const QuicCryptoServerConfig* crypto_config, - QuicDispatcher::PacketWriterFactory* packet_writer_factory, QuicConnectionHelperInterface* helper) : QuicDispatcher(config, crypto_config, QuicSupportedVersions(), - packet_writer_factory, helper) {} MockQuicDispatcher::~MockQuicDispatcher() {} diff --git a/net/quic/test_tools/mock_quic_dispatcher.h b/net/quic/test_tools/mock_quic_dispatcher.h index b3bc85a..2ef1580 100644 --- a/net/quic/test_tools/mock_quic_dispatcher.h +++ b/net/quic/test_tools/mock_quic_dispatcher.h @@ -20,7 +20,6 @@ class MockQuicDispatcher : public tools::QuicDispatcher { public: MockQuicDispatcher(const QuicConfig& config, const QuicCryptoServerConfig* crypto_config, - PacketWriterFactory* packet_writer_factory, QuicConnectionHelperInterface* helper); ~MockQuicDispatcher() override; diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc index bd4b6f5..a2ba09f 100644 --- a/net/quic/test_tools/quic_test_utils.cc +++ b/net/quic/test_tools/quic_test_utils.cc @@ -205,11 +205,6 @@ void MockConnectionHelper::AdvanceTime(QuicTime::Delta delta) { clock_.AdvanceTime(delta); } -QuicPacketWriter* NiceMockPacketWriterFactory::Create( - QuicConnection* /*connection*/) const { - return new testing::NiceMock<MockPacketWriter>(); -} - MockConnection::MockConnection(MockConnectionHelper* helper, Perspective perspective) : MockConnection(kTestConnectionId, @@ -253,7 +248,7 @@ MockConnection::MockConnection(QuicConnectionId connection_id, : QuicConnection(connection_id, address, helper, - NiceMockPacketWriterFactory(), + new testing::NiceMock<MockPacketWriter>(), /* owns_writer= */ true, perspective, supported_versions) { @@ -706,51 +701,6 @@ QuicVersionVector SupportedVersions(QuicVersion version) { return versions; } -TestWriterFactory::TestWriterFactory() : current_writer_(nullptr) {} -TestWriterFactory::~TestWriterFactory() {} - -QuicPacketWriter* TestWriterFactory::Create(QuicPacketWriter* writer, - QuicConnection* connection) { - return new PerConnectionPacketWriter(this, writer, connection); -} - -void TestWriterFactory::OnPacketSent(WriteResult result) { - if (current_writer_ != nullptr && result.status == WRITE_STATUS_ERROR) { - current_writer_->connection()->OnWriteError(result.error_code); - current_writer_ = nullptr; - } -} - -void TestWriterFactory::Unregister(PerConnectionPacketWriter* writer) { - if (current_writer_ == writer) { - current_writer_ = nullptr; - } -} - -TestWriterFactory::PerConnectionPacketWriter::PerConnectionPacketWriter( - TestWriterFactory* factory, - QuicPacketWriter* writer, - QuicConnection* connection) - : QuicPerConnectionPacketWriter(writer, connection), factory_(factory) {} - -TestWriterFactory::PerConnectionPacketWriter::~PerConnectionPacketWriter() { - factory_->Unregister(this); -} - -WriteResult TestWriterFactory::PerConnectionPacketWriter::WritePacket( - const char* buffer, - size_t buf_len, - const IPAddressNumber& self_address, - const IPEndPoint& peer_address) { - // A DCHECK(factory_current_writer_ == nullptr) would be wrong here -- this - // class may be used in a setting where connection()->OnPacketSent() is called - // in a different way, so TestWriterFactory::OnPacketSent might never be - // called. - factory_->current_writer_ = this; - return tools::QuicPerConnectionPacketWriter::WritePacket( - buffer, buf_len, self_address, peer_address); -} - MockQuicConnectionDebugVisitor::MockQuicConnectionDebugVisitor() {} MockQuicConnectionDebugVisitor::~MockQuicConnectionDebugVisitor() {} diff --git a/net/quic/test_tools/quic_test_utils.h b/net/quic/test_tools/quic_test_utils.h index e1eb147..5293e5b 100644 --- a/net/quic/test_tools/quic_test_utils.h +++ b/net/quic/test_tools/quic_test_utils.h @@ -328,17 +328,6 @@ class MockConnectionHelper : public QuicConnectionHelperInterface { DISALLOW_COPY_AND_ASSIGN(MockConnectionHelper); }; -class NiceMockPacketWriterFactory : public QuicConnection::PacketWriterFactory { - public: - NiceMockPacketWriterFactory() {} - ~NiceMockPacketWriterFactory() override {} - - QuicPacketWriter* Create(QuicConnection* /*connection*/) const override; - - private: - DISALLOW_COPY_AND_ASSIGN(NiceMockPacketWriterFactory); -}; - class MockConnection : public QuicConnection { public: // Uses a ConnectionId of 42 and 127.0.0.1:123. @@ -692,46 +681,6 @@ class MockNetworkChangeVisitor DISALLOW_COPY_AND_ASSIGN(MockNetworkChangeVisitor); }; -// Creates per-connection packet writers that register themselves with the -// TestWriterFactory on each write so that TestWriterFactory::OnPacketSent can -// be routed to the appropriate QuicConnection. -class TestWriterFactory : public tools::QuicDispatcher::PacketWriterFactory { - public: - TestWriterFactory(); - ~TestWriterFactory() override; - - QuicPacketWriter* Create(QuicPacketWriter* writer, - QuicConnection* connection) override; - - // Calls OnPacketSent on the last QuicConnection to write through one of the - // packet writers created by this factory. - void OnPacketSent(WriteResult result); - - private: - class PerConnectionPacketWriter - : public tools::QuicPerConnectionPacketWriter { - public: - PerConnectionPacketWriter(TestWriterFactory* factory, - QuicPacketWriter* writer, - QuicConnection* connection); - ~PerConnectionPacketWriter() override; - - WriteResult WritePacket(const char* buffer, - size_t buf_len, - const IPAddressNumber& self_address, - const IPEndPoint& peer_address) override; - - private: - TestWriterFactory* factory_; - }; - - // If an asynchronous write is happening and |writer| gets deleted, this - // clears the pointer to it to prevent use-after-free. - void Unregister(PerConnectionPacketWriter* writer); - - PerConnectionPacketWriter* current_writer_; -}; - class MockQuicConnectionDebugVisitor : public QuicConnectionDebugVisitor { public: MockQuicConnectionDebugVisitor(); diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc index 4e30c39..b1cee41 100644 --- a/net/tools/quic/end_to_end_test.cc +++ b/net/tools/quic/end_to_end_test.cc @@ -68,7 +68,6 @@ using net::test::QuicSentPacketManagerPeer; using net::test::QuicSessionPeer; using net::test::QuicSpdySessionPeer; using net::test::ReliableQuicStreamPeer; -using net::test::TestWriterFactory; using net::test::ValueRestore; using net::test::kClientDataStreamId1; using net::test::kInitialSessionFlowControlWindowForTest; @@ -389,7 +388,7 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> { void SetUp() override { // The ownership of these gets transferred to the QuicPacketWriterWrapper - // and TestWriterFactory when Initialize() is executed. + // when Initialize() is executed. client_writer_ = new PacketDroppingTestWriter(); server_writer_ = new PacketDroppingTestWriter(); } @@ -413,9 +412,6 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> { IPEndPoint(server_address_.address(), server_thread_->GetPort()); QuicDispatcher* dispatcher = QuicServerPeer::GetDispatcher(server_thread_->server()); - TestWriterFactory* packet_writer_factory = new TestWriterFactory(); - QuicDispatcherPeer::SetPacketWriterFactory(dispatcher, - packet_writer_factory); QuicDispatcherPeer::UseWriter(dispatcher, server_writer_); FLAGS_enable_quic_stateless_reject_support = diff --git a/net/tools/quic/quic_client.cc b/net/tools/quic/quic_client.cc index 00d38ea..2ecfe6d 100644 --- a/net/tools/quic/quic_client.cc +++ b/net/tools/quic/quic_client.cc @@ -231,8 +231,6 @@ void QuicClient::StartConnect() { QuicPacketWriter* writer = CreateQuicPacketWriter(); - DummyPacketWriterFactory factory(writer); - if (connected_or_attempting_connect()) { // Before we destroy the last session and create a new one, gather its stats // and update the stats for the overall connection. @@ -248,7 +246,7 @@ void QuicClient::StartConnect() { } CreateQuicClientSession(new QuicConnection( - GetNextConnectionId(), server_address_, helper(), factory, + GetNextConnectionId(), server_address_, helper(), writer, /* owns_writer= */ false, Perspective::IS_CLIENT, supported_versions())); // Reset |writer_| after |session()| so that the old writer outlives the old @@ -376,7 +374,6 @@ bool QuicClient::MigrateSocket(const IPAddressNumber& new_host) { session()->connection()->SetSelfAddress(client_address_); QuicPacketWriter* writer = CreateQuicPacketWriter(); - DummyPacketWriterFactory factory(writer); set_writer(writer); session()->connection()->SetQuicPacketWriter(writer, false); diff --git a/net/tools/quic/quic_client_base.cc b/net/tools/quic/quic_client_base.cc index 2c985c2..5c8daa2 100644 --- a/net/tools/quic/quic_client_base.cc +++ b/net/tools/quic/quic_client_base.cc @@ -36,17 +36,6 @@ bool QuicClientBase::Initialize() { return true; } -QuicClientBase::DummyPacketWriterFactory::DummyPacketWriterFactory( - QuicPacketWriter* writer) - : writer_(writer) {} - -QuicClientBase::DummyPacketWriterFactory::~DummyPacketWriterFactory() {} - -QuicPacketWriter* QuicClientBase::DummyPacketWriterFactory::Create( - QuicConnection* /*connection*/) const { - return writer_; -} - ProofVerifier* QuicClientBase::proof_verifier() const { return crypto_config_.proof_verifier(); } diff --git a/net/tools/quic/quic_client_base.h b/net/tools/quic/quic_client_base.h index 449cc85..2ca8aca 100644 --- a/net/tools/quic/quic_client_base.h +++ b/net/tools/quic/quic_client_base.h @@ -33,18 +33,6 @@ namespace tools { class QuicClientBase { public: - // A packet writer factory that always returns the same writer. - class DummyPacketWriterFactory : public QuicConnection::PacketWriterFactory { - public: - explicit DummyPacketWriterFactory(QuicPacketWriter* writer); - ~DummyPacketWriterFactory() override; - - QuicPacketWriter* Create(QuicConnection* connection) const override; - - private: - QuicPacketWriter* writer_; - }; - QuicClientBase(const QuicServerId& server_id, const QuicVersionVector& supported_versions, const QuicConfig& config, diff --git a/net/tools/quic/quic_dispatcher.cc b/net/tools/quic/quic_dispatcher.cc index 2a9d15d..d4e71b5 100644 --- a/net/tools/quic/quic_dispatcher.cc +++ b/net/tools/quic/quic_dispatcher.cc @@ -144,36 +144,15 @@ class QuicDispatcher::QuicFramerVisitor : public QuicFramerVisitorInterface { QuicConnectionId connection_id_; }; -QuicPacketWriter* QuicDispatcher::DefaultPacketWriterFactory::Create( - QuicPacketWriter* writer, - QuicConnection* connection) { - return new QuicPerConnectionPacketWriter(writer, connection); -} - -QuicDispatcher::PacketWriterFactoryAdapter::PacketWriterFactoryAdapter( - QuicDispatcher* dispatcher) - : dispatcher_(dispatcher) {} - -QuicDispatcher::PacketWriterFactoryAdapter::~PacketWriterFactoryAdapter() {} - -QuicPacketWriter* QuicDispatcher::PacketWriterFactoryAdapter::Create( - QuicConnection* connection) const { - return dispatcher_->packet_writer_factory_->Create(dispatcher_->writer_.get(), - connection); -} - QuicDispatcher::QuicDispatcher(const QuicConfig& config, const QuicCryptoServerConfig* crypto_config, const QuicVersionVector& supported_versions, - PacketWriterFactory* packet_writer_factory, QuicConnectionHelperInterface* helper) : config_(config), crypto_config_(crypto_config), helper_(helper), delete_sessions_alarm_( helper_->CreateAlarm(new DeleteSessionsAlarm(this))), - packet_writer_factory_(packet_writer_factory), - connection_writer_factory_(this), supported_versions_(supported_versions), current_packet_(nullptr), framer_(supported_versions, @@ -451,7 +430,7 @@ QuicServerSessionBase* QuicDispatcher::CreateQuicSession( const IPEndPoint& client_address) { // The QuicServerSessionBase takes ownership of |connection| below. QuicConnection* connection = new QuicConnection( - connection_id, client_address, helper_.get(), connection_writer_factory_, + connection_id, client_address, helper_.get(), CreatePerConnectionWriter(), /* owns_writer= */ true, Perspective::IS_SERVER, supported_versions_); QuicServerSessionBase* session = @@ -463,8 +442,7 @@ QuicServerSessionBase* QuicDispatcher::CreateQuicSession( QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { // TODO(rjshade): The QuicTimeWaitListManager should take ownership of the // per-connection packet writer. - time_wait_list_writer_.reset( - packet_writer_factory_->Create(writer_.get(), nullptr)); + time_wait_list_writer_.reset(CreatePerConnectionWriter()); return new QuicTimeWaitListManager(time_wait_list_writer_.get(), this, helper_.get()); } @@ -486,6 +464,10 @@ bool QuicDispatcher::HandlePacketForTimeWait( return true; } +QuicPacketWriter* QuicDispatcher::CreatePerConnectionWriter() { + return new QuicPerConnectionPacketWriter(writer_.get()); +} + void QuicDispatcher::SetLastError(QuicErrorCode error) { last_error_ = error; } diff --git a/net/tools/quic/quic_dispatcher.h b/net/tools/quic/quic_dispatcher.h index 24f8b4b..3c5b9c9 100644 --- a/net/tools/quic/quic_dispatcher.h +++ b/net/tools/quic/quic_dispatcher.h @@ -45,28 +45,6 @@ class QuicDispatcher : public QuicServerSessionVisitor, public ProcessPacketInterface, public QuicBlockedWriterInterface { public: - // Creates per-connection packet writers out of the QuicDispatcher's shared - // QuicPacketWriter. The per-connection writers' IsWriteBlocked() state must - // always be the same as the shared writer's IsWriteBlocked(), or else the - // QuicDispatcher::OnCanWrite logic will not work. (This will hopefully be - // cleaned up for bug 16950226.) - class PacketWriterFactory { - public: - virtual ~PacketWriterFactory() {} - - virtual QuicPacketWriter* Create(QuicPacketWriter* writer, - QuicConnection* connection) = 0; - }; - - // Creates ordinary QuicPerConnectionPacketWriter instances. - class DefaultPacketWriterFactory : public PacketWriterFactory { - public: - ~DefaultPacketWriterFactory() override {} - - QuicPacketWriter* Create(QuicPacketWriter* writer, - QuicConnection* connection) override; - }; - // Ideally we'd have a linked_hash_set: the boolean is unused. typedef linked_hash_map<QuicBlockedWriterInterface*, bool> WriteBlockedList; @@ -77,7 +55,6 @@ class QuicDispatcher : public QuicServerSessionVisitor, QuicDispatcher(const QuicConfig& config, const QuicCryptoServerConfig* crypto_config, const QuicVersionVector& supported_versions, - PacketWriterFactory* packet_writer_factory, QuicConnectionHelperInterface* helper); ~QuicDispatcher() override; @@ -189,9 +166,12 @@ class QuicDispatcher : public QuicServerSessionVisitor, QuicPacketWriter* writer() { return writer_.get(); } - const QuicConnection::PacketWriterFactory& connection_writer_factory() { - return connection_writer_factory_; - } + // Creates per-connection packet writers out of the QuicDispatcher's shared + // QuicPacketWriter. The per-connection writers' IsWriteBlocked() state must + // always be the same as the shared writer's IsWriteBlocked(), or else the + // QuicDispatcher::OnCanWrite logic will not work. (This will hopefully be + // cleaned up for bug 16950226.) + virtual QuicPacketWriter* CreatePerConnectionWriter(); void SetLastError(QuicErrorCode error); @@ -199,21 +179,6 @@ class QuicDispatcher : public QuicServerSessionVisitor, class QuicFramerVisitor; friend class net::tools::test::QuicDispatcherPeer; - // An adapter that creates packet writers using the dispatcher's - // PacketWriterFactory and shared writer. Essentially, it just curries the - // writer argument away from QuicDispatcher::PacketWriterFactory. - class PacketWriterFactoryAdapter - : public QuicConnection::PacketWriterFactory { - public: - explicit PacketWriterFactoryAdapter(QuicDispatcher* dispatcher); - ~PacketWriterFactoryAdapter() override; - - QuicPacketWriter* Create(QuicConnection* connection) const override; - - private: - QuicDispatcher* dispatcher_; - }; - // Called by |framer_visitor_| when the private header has been parsed // of a data packet that is destined for the time wait manager. void OnUnauthenticatedHeader(const QuicPacketHeader& header); @@ -252,12 +217,6 @@ class QuicDispatcher : public QuicServerSessionVisitor, // A per-connection writer that is passed to the time wait list manager. scoped_ptr<QuicPacketWriter> time_wait_list_writer_; - // Used to create per-connection packet writers, not |writer_| itself. - scoped_ptr<PacketWriterFactory> packet_writer_factory_; - - // Passed in to QuicConnection for it to create the per-connection writers - PacketWriterFactoryAdapter connection_writer_factory_; - // This vector contains QUIC versions which we currently support. // This should be ordered such that the highest supported version is the first // element, with subsequent elements in descending order (versions can be diff --git a/net/tools/quic/quic_dispatcher_test.cc b/net/tools/quic/quic_dispatcher_test.cc index e17526d..babf48a 100644 --- a/net/tools/quic/quic_dispatcher_test.cc +++ b/net/tools/quic/quic_dispatcher_test.cc @@ -34,7 +34,6 @@ using net::test::CryptoTestUtils; using net::test::MockConnection; using net::test::MockConnectionHelper; using net::test::ValueRestore; -using net::test::TestWriterFactory; using std::string; using std::vector; using testing::DoAll; @@ -89,7 +88,6 @@ class TestDispatcher : public QuicDispatcher { : QuicDispatcher(config, crypto_config, QuicSupportedVersions(), - new QuicDispatcher::DefaultPacketWriterFactory(), new QuicEpollConnectionHelper(eps)) {} MOCK_METHOD2(CreateQuicSession, @@ -589,8 +587,6 @@ class QuicDispatcherWriteBlockedListTest : public QuicDispatcherTest { public: void SetUp() override { writer_ = new BlockingWriter; - QuicDispatcherPeer::SetPacketWriterFactory(&dispatcher_, - new TestWriterFactory()); QuicDispatcherPeer::UseWriter(&dispatcher_, writer_); IPEndPoint client_address(net::test::Loopback4(), 1); diff --git a/net/tools/quic/quic_per_connection_packet_writer.cc b/net/tools/quic/quic_per_connection_packet_writer.cc index 0d984ec..f95e016 100644 --- a/net/tools/quic/quic_per_connection_packet_writer.cc +++ b/net/tools/quic/quic_per_connection_packet_writer.cc @@ -9,9 +9,8 @@ namespace net { namespace tools { QuicPerConnectionPacketWriter::QuicPerConnectionPacketWriter( - QuicPacketWriter* shared_writer, - QuicConnection* connection) - : shared_writer_(shared_writer), connection_(connection) {} + QuicPacketWriter* shared_writer) + : shared_writer_(shared_writer) {} QuicPerConnectionPacketWriter::~QuicPerConnectionPacketWriter() {} diff --git a/net/tools/quic/quic_per_connection_packet_writer.h b/net/tools/quic/quic_per_connection_packet_writer.h index 8a3769a..e4c2045 100644 --- a/net/tools/quic/quic_per_connection_packet_writer.h +++ b/net/tools/quic/quic_per_connection_packet_writer.h @@ -15,17 +15,14 @@ namespace net { namespace tools { -// A connection-specific packet writer that wraps a shared writer and keeps a -// reference to the connection. +// A connection-specific packet writer that wraps a shared writer. class QuicPerConnectionPacketWriter : public QuicPacketWriter { public: - // Does not take ownership of |shared_writer| or |connection|. - QuicPerConnectionPacketWriter(QuicPacketWriter* shared_writer, - QuicConnection* connection); + // Does not take ownership of |shared_writer|. + QuicPerConnectionPacketWriter(QuicPacketWriter* shared_writer); ~QuicPerConnectionPacketWriter() override; QuicPacketWriter* shared_writer() const { return shared_writer_; } - QuicConnection* connection() const { return connection_; } // Default implementation of the QuicPacketWriter interface: Passes everything // to |shared_writer_|. @@ -40,7 +37,6 @@ class QuicPerConnectionPacketWriter : public QuicPacketWriter { private: QuicPacketWriter* shared_writer_; // Not owned. - QuicConnection* connection_; // Not owned. DISALLOW_COPY_AND_ASSIGN(QuicPerConnectionPacketWriter); }; diff --git a/net/tools/quic/quic_server.cc b/net/tools/quic/quic_server.cc index 2ed4e5b..7430600 100644 --- a/net/tools/quic/quic_server.cc +++ b/net/tools/quic/quic_server.cc @@ -180,7 +180,6 @@ QuicDefaultPacketWriter* QuicServer::CreateWriter(int fd) { QuicDispatcher* QuicServer::CreateQuicDispatcher() { return new QuicDispatcher(config_, &crypto_config_, supported_versions_, - new QuicDispatcher::DefaultPacketWriterFactory(), new QuicEpollConnectionHelper(&epoll_server_)); } diff --git a/net/tools/quic/quic_server_test.cc b/net/tools/quic/quic_server_test.cc index 0e2d6ee..60b2a69 100644 --- a/net/tools/quic/quic_server_test.cc +++ b/net/tools/quic/quic_server_test.cc @@ -29,7 +29,6 @@ class QuicServerDispatchPacketTest : public ::testing::Test { CryptoTestUtils::ProofSourceForTesting()), dispatcher_(config_, &crypto_config_, - new QuicDispatcher::DefaultPacketWriterFactory(), new QuicEpollConnectionHelper(&eps_)) { dispatcher_.InitializeWithWriter(new QuicDefaultPacketWriter(1234)); } diff --git a/net/tools/quic/quic_simple_client.cc b/net/tools/quic/quic_simple_client.cc index 9890e0c..3874988 100644 --- a/net/tools/quic/quic_simple_client.cc +++ b/net/tools/quic/quic_simple_client.cc @@ -203,8 +203,6 @@ void QuicSimpleClient::StartConnect() { set_writer(CreateQuicPacketWriter()); - DummyPacketWriterFactory factory(writer()); - if (connected_or_attempting_connect()) { // Before we destroy the last session and create a new one, gather its stats // and update the stats for the overall connection. @@ -220,7 +218,7 @@ void QuicSimpleClient::StartConnect() { } CreateQuicClientSession(new QuicConnection( - GetNextConnectionId(), server_address_, helper(), factory, + GetNextConnectionId(), server_address_, helper(), writer(), /* owns_writer= */ false, Perspective::IS_CLIENT, supported_versions())); session()->Initialize(); @@ -335,7 +333,6 @@ bool QuicSimpleClient::MigrateSocket(const IPAddressNumber& new_host) { session()->connection()->SetSelfAddress(client_address_); QuicPacketWriter* writer = CreateQuicPacketWriter(); - DummyPacketWriterFactory factory(writer); set_writer(writer); session()->connection()->SetQuicPacketWriter(writer, false); diff --git a/net/tools/quic/quic_simple_per_connection_packet_writer.cc b/net/tools/quic/quic_simple_per_connection_packet_writer.cc index bc6e45f..9020a2ff 100644 --- a/net/tools/quic/quic_simple_per_connection_packet_writer.cc +++ b/net/tools/quic/quic_simple_per_connection_packet_writer.cc @@ -11,10 +11,9 @@ namespace net { namespace tools { QuicSimplePerConnectionPacketWriter::QuicSimplePerConnectionPacketWriter( - QuicSimpleServerPacketWriter* shared_writer, - QuicConnection* connection) + QuicSimpleServerPacketWriter* shared_writer) : shared_writer_(shared_writer), - connection_(connection), + connection_(nullptr), weak_factory_(this) {} QuicSimplePerConnectionPacketWriter::~QuicSimplePerConnectionPacketWriter() {} diff --git a/net/tools/quic/quic_simple_per_connection_packet_writer.h b/net/tools/quic/quic_simple_per_connection_packet_writer.h index 1914ba9..b3fd647 100644 --- a/net/tools/quic/quic_simple_per_connection_packet_writer.h +++ b/net/tools/quic/quic_simple_per_connection_packet_writer.h @@ -25,11 +25,11 @@ class QuicSimplePerConnectionPacketWriter : public QuicPacketWriter { public: // Does not take ownership of |shared_writer| or |connection|. QuicSimplePerConnectionPacketWriter( - QuicSimpleServerPacketWriter* shared_writer, - QuicConnection* connection); + QuicSimpleServerPacketWriter* shared_writer); ~QuicSimplePerConnectionPacketWriter() override; QuicPacketWriter* shared_writer() const; + void set_connection(QuicConnection* connection) { connection_ = connection; } QuicConnection* connection() const { return connection_; } // Default implementation of the QuicPacketWriter interface: Passes everything diff --git a/net/tools/quic/quic_simple_server.cc b/net/tools/quic/quic_simple_server.cc index 970749d..722e480 100644 --- a/net/tools/quic/quic_simple_server.cc +++ b/net/tools/quic/quic_simple_server.cc @@ -32,33 +32,30 @@ const char kSourceAddressTokenSecret[] = "secret"; // the limit. const int kReadBufferSize = 2 * kMaxPacketSize; -// A packet writer factory which wraps a shared QuicSimpleServerPacketWriter -// inside of a QuicPerConnectionPacketWriter. Instead of checking that -// the shared_writer is the expected writer, this could instead cast -// from QuicPacketWriter to QuicSimpleServerPacketWriter. -class CustomPacketWriterFactory : public QuicDispatcher::PacketWriterFactory { +class SimpleQuicDispatcher : public QuicDispatcher { public: - ~CustomPacketWriterFactory() override {} - - QuicPacketWriter* Create(QuicPacketWriter* writer, - QuicConnection* connection) override { - if (writer == nullptr) { - LOG(DFATAL) << "shared_writer not initialized"; - return nullptr; - } - if (writer != shared_writer_) { - LOG(DFATAL) << "writer mismatch"; - return nullptr; - } - return new QuicSimplePerConnectionPacketWriter(shared_writer_, connection); + SimpleQuicDispatcher(const QuicConfig& config, + const QuicCryptoServerConfig* crypto_config, + const QuicVersionVector& supported_versions, + QuicConnectionHelperInterface* helper) + : QuicDispatcher(config, crypto_config, supported_versions, helper) {} + + protected: + QuicServerSessionBase* CreateQuicSession( + QuicConnectionId connection_id, + const IPEndPoint& client_address) override { + QuicServerSessionBase* session = + QuicDispatcher::CreateQuicSession(connection_id, client_address); + static_cast<QuicSimplePerConnectionPacketWriter*>( + session->connection()->writer()) + ->set_connection(session->connection()); + return session; } - void set_shared_writer(QuicSimpleServerPacketWriter* shared_writer) { - shared_writer_ = shared_writer; + QuicPacketWriter* CreatePerConnectionWriter() override { + return new QuicSimplePerConnectionPacketWriter( + static_cast<QuicSimpleServerPacketWriter*>(writer())); } - - private: - QuicSimpleServerPacketWriter* shared_writer_; // Not owned. }; } // namespace @@ -147,12 +144,10 @@ int QuicSimpleServer::Listen(const IPEndPoint& address) { socket_.swap(socket); - CustomPacketWriterFactory* factory = new CustomPacketWriterFactory(); - dispatcher_.reset(new QuicDispatcher(config_, &crypto_config_, - supported_versions_, factory, helper_)); + dispatcher_.reset(new SimpleQuicDispatcher(config_, &crypto_config_, + supported_versions_, helper_)); QuicSimpleServerPacketWriter* writer = new QuicSimpleServerPacketWriter(socket_.get(), dispatcher_.get()); - factory->set_shared_writer(writer); dispatcher_->InitializeWithWriter(writer); StartReading(); diff --git a/net/tools/quic/quic_simple_server_test.cc b/net/tools/quic/quic_simple_server_test.cc index c941f44..d98069c 100644 --- a/net/tools/quic/quic_simple_server_test.cc +++ b/net/tools/quic/quic_simple_server_test.cc @@ -27,7 +27,6 @@ class QuicChromeServerDispatchPacketTest : public ::testing::Test { CryptoTestUtils::ProofSourceForTesting()), dispatcher_(config_, &crypto_config_, - new tools::QuicDispatcher::DefaultPacketWriterFactory(), new net::test::MockConnectionHelper) { dispatcher_.InitializeWithWriter(nullptr); } diff --git a/net/tools/quic/test_tools/quic_dispatcher_peer.cc b/net/tools/quic/test_tools/quic_dispatcher_peer.cc index 88a3078..ab8f281 100644 --- a/net/tools/quic/test_tools/quic_dispatcher_peer.cc +++ b/net/tools/quic/test_tools/quic_dispatcher_peer.cc @@ -31,13 +31,6 @@ QuicPacketWriter* QuicDispatcherPeer::GetWriter(QuicDispatcher* dispatcher) { } // static -void QuicDispatcherPeer::SetPacketWriterFactory( - QuicDispatcher* dispatcher, - QuicDispatcher::PacketWriterFactory* packet_writer_factory) { - dispatcher->packet_writer_factory_.reset(packet_writer_factory); -} - -// static QuicConnectionHelperInterface* QuicDispatcherPeer::GetHelper( QuicDispatcher* dispatcher) { return dispatcher->helper_.get(); diff --git a/net/tools/quic/test_tools/quic_dispatcher_peer.h b/net/tools/quic/test_tools/quic_dispatcher_peer.h index 936e061..19311bd 100644 --- a/net/tools/quic/test_tools/quic_dispatcher_peer.h +++ b/net/tools/quic/test_tools/quic_dispatcher_peer.h @@ -29,10 +29,6 @@ class QuicDispatcherPeer { static QuicPacketWriter* GetWriter(QuicDispatcher* dispatcher); - static void SetPacketWriterFactory( - QuicDispatcher* dispatcher, - QuicDispatcher::PacketWriterFactory* packet_writer_factory); - static QuicConnectionHelperInterface* GetHelper(QuicDispatcher* dispatcher); static QuicDispatcher::WriteBlockedList* GetWriteBlockedList( diff --git a/net/tools/quic/test_tools/quic_test_server.cc b/net/tools/quic/test_tools/quic_test_server.cc index 4ba113f..43dacf6 100644 --- a/net/tools/quic/test_tools/quic_test_server.cc +++ b/net/tools/quic/test_tools/quic_test_server.cc @@ -68,9 +68,8 @@ class QuicTestDispatcher : public QuicDispatcher { QuicTestDispatcher(const QuicConfig& config, const QuicCryptoServerConfig* crypto_config, const QuicVersionVector& versions, - PacketWriterFactory* factory, QuicConnectionHelperInterface* helper) - : QuicDispatcher(config, crypto_config, versions, factory, helper), + : QuicDispatcher(config, crypto_config, versions, helper), session_factory_(nullptr), stream_factory_(nullptr), crypto_stream_factory_(nullptr) {} @@ -83,7 +82,7 @@ class QuicTestDispatcher : public QuicDispatcher { return QuicDispatcher::CreateQuicSession(id, client); } QuicConnection* connection = new QuicConnection( - id, client, helper(), connection_writer_factory(), + id, client, helper(), CreatePerConnectionWriter(), /* owns_writer= */ true, Perspective::IS_SERVER, supported_versions()); QuicServerSessionBase* session = nullptr; @@ -137,10 +136,9 @@ QuicTestServer::QuicTestServer(ProofSource* proof_source, : QuicServer(proof_source, config, supported_versions) {} QuicDispatcher* QuicTestServer::CreateQuicDispatcher() { - return new QuicTestDispatcher( - config(), &crypto_config(), supported_versions(), - new QuicDispatcher::DefaultPacketWriterFactory(), - new QuicEpollConnectionHelper(epoll_server())); + return new QuicTestDispatcher(config(), &crypto_config(), + supported_versions(), + new QuicEpollConnectionHelper(epoll_server())); } void QuicTestServer::SetSessionFactory(SessionFactory* factory) { |