Commit 3f8b2db5 authored by Victor Vasiliev's avatar Victor Vasiliev Committed by Commit Bot

Reconcile code differences between google3 and Chromium QUIC code

Merge internal change: 237089889

R=rch@chromium.org

Change-Id: I8051e8cb9260833d678884a0affcb272ada8cd12
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1507194
Commit-Queue: Victor Vasiliev <vasilvv@chromium.org>
Reviewed-by: default avatarRyan Hamilton <rch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638707}
parent 0a942fb1
...@@ -3061,6 +3061,7 @@ if (is_linux) { ...@@ -3061,6 +3061,7 @@ if (is_linux) {
"third_party/quic/core/quic_epoll_connection_helper.h", "third_party/quic/core/quic_epoll_connection_helper.h",
"third_party/quic/core/quic_packet_reader.cc", "third_party/quic/core/quic_packet_reader.cc",
"third_party/quic/core/quic_packet_reader.h", "third_party/quic/core/quic_packet_reader.h",
"third_party/quic/platform/api/quic_default_buffer_allocator.h",
"third_party/quic/platform/api/quic_default_proof_providers.h", "third_party/quic/platform/api/quic_default_proof_providers.h",
"third_party/quic/platform/api/quic_system_event_loop.h", "third_party/quic/platform/api/quic_system_event_loop.h",
"third_party/quic/platform/impl/batch_writer/quic_batch_writer_base.cc", "third_party/quic/platform/impl/batch_writer/quic_batch_writer_base.cc",
...@@ -3071,6 +3072,7 @@ if (is_linux) { ...@@ -3071,6 +3072,7 @@ if (is_linux) {
"third_party/quic/platform/impl/batch_writer/quic_gso_batch_writer.h", "third_party/quic/platform/impl/batch_writer/quic_gso_batch_writer.h",
"third_party/quic/platform/impl/batch_writer/quic_sendmmsg_batch_writer.cc", "third_party/quic/platform/impl/batch_writer/quic_sendmmsg_batch_writer.cc",
"third_party/quic/platform/impl/batch_writer/quic_sendmmsg_batch_writer.h", "third_party/quic/platform/impl/batch_writer/quic_sendmmsg_batch_writer.h",
"third_party/quic/platform/impl/quic_default_buffer_allocator_impl.h",
"third_party/quic/platform/impl/quic_default_proof_providers_impl.cc", "third_party/quic/platform/impl/quic_default_proof_providers_impl.cc",
"third_party/quic/platform/impl/quic_default_proof_providers_impl.h", "third_party/quic/platform/impl/quic_default_proof_providers_impl.h",
"third_party/quic/platform/impl/quic_epoll_clock.cc", "third_party/quic/platform/impl/quic_epoll_clock.cc",
...@@ -3343,8 +3345,6 @@ source_set("quic_test_tools") { ...@@ -3343,8 +3345,6 @@ source_set("quic_test_tools") {
sources += [ sources += [
"third_party/quic/test_tools/bad_packet_writer.cc", "third_party/quic/test_tools/bad_packet_writer.cc",
"third_party/quic/test_tools/bad_packet_writer.h", "third_party/quic/test_tools/bad_packet_writer.h",
"third_party/quic/test_tools/fake_epoll_server.cc",
"third_party/quic/test_tools/fake_epoll_server.h",
"third_party/quic/test_tools/limited_mtu_test_writer.cc", "third_party/quic/test_tools/limited_mtu_test_writer.cc",
"third_party/quic/test_tools/limited_mtu_test_writer.h", "third_party/quic/test_tools/limited_mtu_test_writer.h",
"third_party/quic/test_tools/packet_dropping_test_writer.cc", "third_party/quic/test_tools/packet_dropping_test_writer.cc",
...@@ -3361,6 +3361,8 @@ source_set("quic_test_tools") { ...@@ -3361,6 +3361,8 @@ source_set("quic_test_tools") {
"third_party/quic/test_tools/quic_test_server.h", "third_party/quic/test_tools/quic_test_server.h",
"third_party/quic/test_tools/server_thread.cc", "third_party/quic/test_tools/server_thread.cc",
"third_party/quic/test_tools/server_thread.h", "third_party/quic/test_tools/server_thread.h",
"tools/epoll_server/fake_epoll_server.cc",
"tools/epoll_server/fake_epoll_server.h",
] ]
deps += [ deps += [
":epoll_quic_tools", ":epoll_quic_tools",
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "net/third_party/quic/core/quic_utils.h" #include "net/third_party/quic/core/quic_utils.h"
#include "net/third_party/quic/platform/api/quic_arraysize.h" #include "net/third_party/quic/platform/api/quic_arraysize.h"
#include "net/third_party/quic/platform/api/quic_singleton.h"
namespace quic { namespace quic {
...@@ -142,17 +141,10 @@ class CommonCertSetsQUIC : public CommonCertSets { ...@@ -142,17 +141,10 @@ class CommonCertSetsQUIC : public CommonCertSets {
return false; return false;
} }
static CommonCertSetsQUIC* GetInstance() {
return QuicSingleton<CommonCertSetsQUIC>::get();
}
private:
CommonCertSetsQUIC() {} CommonCertSetsQUIC() {}
CommonCertSetsQUIC(const CommonCertSetsQUIC&) = delete; CommonCertSetsQUIC(const CommonCertSetsQUIC&) = delete;
CommonCertSetsQUIC& operator=(const CommonCertSetsQUIC&) = delete; CommonCertSetsQUIC& operator=(const CommonCertSetsQUIC&) = delete;
~CommonCertSetsQUIC() override {} ~CommonCertSetsQUIC() override {}
friend QuicSingletonFriend<CommonCertSetsQUIC>;
}; };
} // anonymous namespace } // anonymous namespace
...@@ -161,7 +153,8 @@ CommonCertSets::~CommonCertSets() {} ...@@ -161,7 +153,8 @@ CommonCertSets::~CommonCertSets() {}
// static // static
const CommonCertSets* CommonCertSets::GetInstanceQUIC() { const CommonCertSets* CommonCertSets::GetInstanceQUIC() {
return CommonCertSetsQUIC::GetInstance(); static CommonCertSetsQUIC* certs = new CommonCertSetsQUIC();
return certs;
} }
} // namespace quic } // namespace quic
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "net/third_party/quic/platform/api/quic_bug_tracker.h" #include "net/third_party/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quic/platform/api/quic_singleton.h"
#include "third_party/boringssl/src/include/openssl/rand.h" #include "third_party/boringssl/src/include/openssl/rand.h"
namespace quic { namespace quic {
...@@ -15,25 +14,16 @@ namespace { ...@@ -15,25 +14,16 @@ namespace {
class DefaultRandom : public QuicRandom { class DefaultRandom : public QuicRandom {
public: public:
static DefaultRandom* GetInstance();
// QuicRandom implementation
void RandBytes(void* data, size_t len) override;
uint64_t RandUint64() override;
private:
DefaultRandom() {} DefaultRandom() {}
DefaultRandom(const DefaultRandom&) = delete; DefaultRandom(const DefaultRandom&) = delete;
DefaultRandom& operator=(const DefaultRandom&) = delete; DefaultRandom& operator=(const DefaultRandom&) = delete;
~DefaultRandom() override {} ~DefaultRandom() override {}
friend QuicSingletonFriend<DefaultRandom>; // QuicRandom implementation
void RandBytes(void* data, size_t len) override;
uint64_t RandUint64() override;
}; };
DefaultRandom* DefaultRandom::GetInstance() {
return QuicSingleton<DefaultRandom>::get();
}
void DefaultRandom::RandBytes(void* data, size_t len) { void DefaultRandom::RandBytes(void* data, size_t len) {
RAND_bytes(reinterpret_cast<uint8_t*>(data), len); RAND_bytes(reinterpret_cast<uint8_t*>(data), len);
} }
...@@ -48,7 +38,8 @@ uint64_t DefaultRandom::RandUint64() { ...@@ -48,7 +38,8 @@ uint64_t DefaultRandom::RandUint64() {
// static // static
QuicRandom* QuicRandom::GetInstance() { QuicRandom* QuicRandom::GetInstance() {
return DefaultRandom::GetInstance(); static DefaultRandom* random = new DefaultRandom();
return random;
} }
} // namespace quic } // namespace quic
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "net/third_party/quic/core/quic_epoll_alarm_factory.h" #include "net/third_party/quic/core/quic_epoll_alarm_factory.h"
#include <type_traits>
#include "net/third_party/quic/core/quic_arena_scoped_ptr.h" #include "net/third_party/quic/core/quic_arena_scoped_ptr.h"
namespace quic { namespace quic {
...@@ -42,10 +44,12 @@ class QuicEpollAlarm : public QuicAlarm { ...@@ -42,10 +44,12 @@ class QuicEpollAlarm : public QuicAlarm {
private: private:
class EpollAlarmImpl : public QuicEpollAlarmBase { class EpollAlarmImpl : public QuicEpollAlarmBase {
public: public:
using int64_epoll = decltype(QuicEpollAlarmBase().OnAlarm());
explicit EpollAlarmImpl(QuicEpollAlarm* alarm) : alarm_(alarm) {} explicit EpollAlarmImpl(QuicEpollAlarm* alarm) : alarm_(alarm) {}
// Use the same integer type as the base class. // Use the same integer type as the base class.
int64_t /* allow-non-std-int */ OnAlarm() override { int64_epoll OnAlarm() override {
QuicEpollAlarmBase::OnAlarm(); QuicEpollAlarmBase::OnAlarm();
alarm_->Fire(); alarm_->Fire();
// Fire will take care of registering the alarm, if needed. // Fire will take care of registering the alarm, if needed.
...@@ -78,8 +82,8 @@ QuicArenaScopedPtr<QuicAlarm> QuicEpollAlarmFactory::CreateAlarm( ...@@ -78,8 +82,8 @@ QuicArenaScopedPtr<QuicAlarm> QuicEpollAlarmFactory::CreateAlarm(
if (arena != nullptr) { if (arena != nullptr) {
return arena->New<QuicEpollAlarm>(epoll_server_, std::move(delegate)); return arena->New<QuicEpollAlarm>(epoll_server_, std::move(delegate));
} }
return QuicArenaScopedPtr<QuicAlarm>( return QuicArenaScopedPtr<QuicAlarm>(
new QuicEpollAlarm(epoll_server_, std::move(delegate))); new QuicEpollAlarm(epoll_server_, std::move(delegate)));
} }
} // namespace quic } // namespace quic
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "net/third_party/quic/core/quic_packets.h" #include "net/third_party/quic/core/quic_packets.h"
#include "net/third_party/quic/core/quic_simple_buffer_allocator.h" #include "net/third_party/quic/core/quic_simple_buffer_allocator.h"
#include "net/third_party/quic/core/quic_time.h" #include "net/third_party/quic/core/quic_time.h"
#include "net/third_party/quic/platform/api/quic_default_buffer_allocator.h"
#include "net/third_party/quic/platform/api/quic_epoll.h" #include "net/third_party/quic/platform/api/quic_epoll.h"
#include "net/third_party/quic/platform/impl/quic_epoll_clock.h" #include "net/third_party/quic/platform/impl/quic_epoll_clock.h"
...@@ -24,8 +25,6 @@ namespace quic { ...@@ -24,8 +25,6 @@ namespace quic {
class QuicRandom; class QuicRandom;
using QuicStreamBufferAllocator = SimpleBufferAllocator;
enum class QuicAllocator { SIMPLE, BUFFER_POOL }; enum class QuicAllocator { SIMPLE, BUFFER_POOL };
class QuicEpollConnectionHelper : public QuicConnectionHelperInterface { class QuicEpollConnectionHelper : public QuicConnectionHelperInterface {
...@@ -46,7 +45,7 @@ class QuicEpollConnectionHelper : public QuicConnectionHelperInterface { ...@@ -46,7 +45,7 @@ class QuicEpollConnectionHelper : public QuicConnectionHelperInterface {
QuicRandom* random_generator_; QuicRandom* random_generator_;
// Set up allocators. They take up minimal memory before use. // Set up allocators. They take up minimal memory before use.
// Allocator for stream send buffers. // Allocator for stream send buffers.
QuicStreamBufferAllocator stream_buffer_allocator_; QuicDefaultBufferAllocator stream_buffer_allocator_;
SimpleBufferAllocator simple_buffer_allocator_; SimpleBufferAllocator simple_buffer_allocator_;
QuicAllocator allocator_type_; QuicAllocator allocator_type_;
}; };
......
...@@ -65,7 +65,7 @@ bool QuicPacketReader::ReadAndDispatchPackets( ...@@ -65,7 +65,7 @@ bool QuicPacketReader::ReadAndDispatchPackets(
const QuicClock& clock, const QuicClock& clock,
ProcessPacketInterface* processor, ProcessPacketInterface* processor,
QuicPacketCount* packets_dropped) { QuicPacketCount* packets_dropped) {
#if MMSG_MORE #if MMSG_MORE_NO_ANDROID
return ReadAndDispatchManyPackets(fd, port, clock, processor, return ReadAndDispatchManyPackets(fd, port, clock, processor,
packets_dropped); packets_dropped);
#else #else
...@@ -80,7 +80,7 @@ bool QuicPacketReader::ReadAndDispatchManyPackets( ...@@ -80,7 +80,7 @@ bool QuicPacketReader::ReadAndDispatchManyPackets(
const QuicClock& clock, const QuicClock& clock,
ProcessPacketInterface* processor, ProcessPacketInterface* processor,
QuicPacketCount* packets_dropped) { QuicPacketCount* packets_dropped) {
#if MMSG_MORE #if MMSG_MORE_NO_ANDROID
// Re-set the length fields in case recvmmsg has changed them. // Re-set the length fields in case recvmmsg has changed them.
for (int i = 0; i < kNumPacketsPerReadMmsgCall; ++i) { for (int i = 0; i < kNumPacketsPerReadMmsgCall; ++i) {
DCHECK_LE(kMaxPacketSize, packets_[i].iov.iov_len); DCHECK_LE(kMaxPacketSize, packets_[i].iov.iov_len);
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include "net/third_party/quic/platform/api/quic_socket_address.h" #include "net/third_party/quic/platform/api/quic_socket_address.h"
#include "net/third_party/quic/platform/impl/quic_socket_utils.h" #include "net/third_party/quic/platform/impl/quic_socket_utils.h"
#define MMSG_MORE 0
namespace quic { namespace quic {
#if MMSG_MORE #if MMSG_MORE
......
...@@ -13,6 +13,8 @@ namespace quic { ...@@ -13,6 +13,8 @@ namespace quic {
// Used to generate filtered supported versions based on flags. // Used to generate filtered supported versions based on flags.
class QUIC_EXPORT_PRIVATE QuicVersionManager { class QUIC_EXPORT_PRIVATE QuicVersionManager {
public: public:
// |supported_versions| should be sorted in the order of preference (typically
// highest supported version to the lowest supported version).
explicit QuicVersionManager(ParsedQuicVersionVector supported_versions); explicit QuicVersionManager(ParsedQuicVersionVector supported_versions);
virtual ~QuicVersionManager(); virtual ~QuicVersionManager();
...@@ -20,7 +22,8 @@ class QUIC_EXPORT_PRIVATE QuicVersionManager { ...@@ -20,7 +22,8 @@ class QUIC_EXPORT_PRIVATE QuicVersionManager {
// TODO(nharper): Remove this method once it is unused. // TODO(nharper): Remove this method once it is unused.
const QuicTransportVersionVector& GetSupportedTransportVersions(); const QuicTransportVersionVector& GetSupportedTransportVersions();
// Returns currently supported QUIC versions. // Returns currently supported QUIC versions. This vector has the same order
// as the versions passed to the constructor.
const ParsedQuicVersionVector& GetSupportedVersions(); const ParsedQuicVersionVector& GetSupportedVersions();
protected: protected:
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "net/third_party/quic/core/tls_client_handshaker.h" #include "net/third_party/quic/core/tls_client_handshaker.h"
#include "net/third_party/quic/platform/api/quic_arraysize.h" #include "net/third_party/quic/platform/api/quic_arraysize.h"
#include "net/third_party/quic/platform/api/quic_bug_tracker.h" #include "net/third_party/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quic/platform/api/quic_singleton.h"
#include "third_party/boringssl/src/include/openssl/crypto.h" #include "third_party/boringssl/src/include/openssl/crypto.h"
#include "third_party/boringssl/src/include/openssl/ssl.h" #include "third_party/boringssl/src/include/openssl/ssl.h"
...@@ -19,7 +18,8 @@ namespace { ...@@ -19,7 +18,8 @@ namespace {
class SslIndexSingleton { class SslIndexSingleton {
public: public:
static SslIndexSingleton* GetInstance() { static SslIndexSingleton* GetInstance() {
return QuicSingleton<SslIndexSingleton>::get(); static SslIndexSingleton* instance = new SslIndexSingleton();
return instance;
} }
int HandshakerIndex() const { return ssl_ex_data_index_handshaker_; } int HandshakerIndex() const { return ssl_ex_data_index_handshaker_; }
...@@ -35,8 +35,6 @@ class SslIndexSingleton { ...@@ -35,8 +35,6 @@ class SslIndexSingleton {
SslIndexSingleton(const SslIndexSingleton&) = delete; SslIndexSingleton(const SslIndexSingleton&) = delete;
SslIndexSingleton& operator=(const SslIndexSingleton&) = delete; SslIndexSingleton& operator=(const SslIndexSingleton&) = delete;
friend QuicSingletonFriend<SslIndexSingleton>;
int ssl_ex_data_index_handshaker_; int ssl_ex_data_index_handshaker_;
}; };
......
// Copyright (c) 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_DEFAULT_BUFFER_ALLOCATOR_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_DEFAULT_BUFFER_ALLOCATOR_H_
#include "net/third_party/quic/platform/impl/quic_default_buffer_allocator_impl.h"
namespace quic {
using QuicDefaultBufferAllocator = QuicStreamBufferAllocatorImpl;
}
#endif // NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_DEFAULT_BUFFER_ALLOCATOR_H_
...@@ -11,4 +11,6 @@ inline void QuicRunSystemEventLoopIteration() { ...@@ -11,4 +11,6 @@ inline void QuicRunSystemEventLoopIteration() {
QuicRunSystemEventLoopIterationImpl(); QuicRunSystemEventLoopIterationImpl();
} }
using QuicSystemEventLoop = QuicSystemEventLoopImpl;
#endif // NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_SYSTEM_EVENT_LOOP_H_ #endif // NET_THIRD_PARTY_QUIC_PLATFORM_API_QUIC_SYSTEM_EVENT_LOOP_H_
#ifndef NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_DEFAULT_BUFFER_ALLOCATOR_IMPL_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_DEFAULT_BUFFER_ALLOCATOR_IMPL_H_
#include "net/third_party/quic/core/quic_simple_buffer_allocator.h"
namespace quic {
using QuicStreamBufferAllocatorImpl = SimpleBufferAllocator;
} // namespace quic
#endif /* NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_DEFAULT_BUFFER_ALLOCATOR_IMPL_H_ \
*/
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "net/third_party/quic/platform/api/quic_flags.h" #include "net/third_party/quic/platform/api/quic_flags.h"
#include "net/third_party/quic/platform/api/quic_test.h" #include "net/third_party/quic/platform/api/quic_test.h"
#include "net/third_party/quic/test_tools/fake_epoll_server.h" #include "net/tools/epoll_server/fake_epoll_server.h"
namespace quic { namespace quic {
namespace test { namespace test {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_EPOLL_TEST_TOOLS_IMPL_H_ #ifndef NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_EPOLL_TEST_TOOLS_IMPL_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_EPOLL_TEST_TOOLS_IMPL_H_ #define NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_EPOLL_TEST_TOOLS_IMPL_H_
#include "net/third_party/quic/test_tools/fake_epoll_server.h" #include "net/tools/epoll_server/fake_epoll_server.h"
using QuicFakeEpollServerImpl = quic::test::FakeEpollServer; using QuicFakeEpollServerImpl = quic::test::FakeEpollServer;
......
...@@ -31,8 +31,11 @@ QuicSocketAddressImpl::QuicSocketAddressImpl( ...@@ -31,8 +31,11 @@ QuicSocketAddressImpl::QuicSocketAddressImpl(
} }
QuicSocketAddressImpl::QuicSocketAddressImpl(const struct sockaddr& saddr) { QuicSocketAddressImpl::QuicSocketAddressImpl(const struct sockaddr& saddr) {
QUIC_BUG << "QuicSocketAddressImpl(const struct sockaddr& saddr) is not " if (saddr.sa_family == AF_INET) {
"implemented."; CHECK(socket_address_.FromSockAddr(&saddr, sizeof(struct sockaddr_in)));
} else if (saddr.sa_family == AF_INET6) {
CHECK(socket_address_.FromSockAddr(&saddr, sizeof(struct sockaddr_in6)));
}
} }
bool operator==(const QuicSocketAddressImpl& lhs, bool operator==(const QuicSocketAddressImpl& lhs,
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
#include "net/third_party/quic/core/quic_bandwidth.h" #include "net/third_party/quic/core/quic_bandwidth.h"
#include "net/third_party/quic/core/quic_types.h" #include "net/third_party/quic/core/quic_types.h"
#define MMSG_MORE 0
#define MMSG_MORE_NO_ANDROID 0
namespace quic { namespace quic {
class QuicIpAddress; class QuicIpAddress;
class QuicSocketAddress; class QuicSocketAddress;
......
...@@ -5,10 +5,22 @@ ...@@ -5,10 +5,22 @@
#ifndef NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_SYSTEM_EVENT_LOOP_IMPL_H_ #ifndef NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_SYSTEM_EVENT_LOOP_IMPL_H_
#define NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_SYSTEM_EVENT_LOOP_IMPL_H_ #define NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_SYSTEM_EVENT_LOOP_IMPL_H_
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/task/task_scheduler/task_scheduler.h"
inline void QuicRunSystemEventLoopIterationImpl() { inline void QuicRunSystemEventLoopIterationImpl() {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
} }
class QuicSystemEventLoopImpl {
public:
QuicSystemEventLoopImpl(std::string context_name) {
base::TaskScheduler::CreateAndStartWithDefaultParams(context_name);
}
private:
base::MessageLoopForIO message_loop_;
};
#endif // NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_SYSTEM_EVENT_LOOP_IMPL_H_ #endif // NET_THIRD_PARTY_QUIC_PLATFORM_IMPL_QUIC_SYSTEM_EVENT_LOOP_IMPL_H_
...@@ -80,7 +80,8 @@ TEST_F(QuartcEndpointTest, ClientCreatesSessionAsynchronously) { ...@@ -80,7 +80,8 @@ TEST_F(QuartcEndpointTest, ClientCreatesSessionAsynchronously) {
// Tests that the server can negotiate for an older QUIC version if the client // Tests that the server can negotiate for an older QUIC version if the client
// attempts to connect using a newer version. // attempts to connect using a newer version.
TEST_F(QuartcEndpointTest, DISABLED_ServerNegotiatesForOldVersion) { TEST_F(QuartcEndpointTest,
QUIC_TEST_DISABLED_IN_CHROME(ServerNegotiatesForOldVersion)) {
// Note: for this test, we need support for two versions. Which two shouldn't // Note: for this test, we need support for two versions. Which two shouldn't
// matter, but they must be enabled so that the version manager doesn't filter // matter, but they must be enabled so that the version manager doesn't filter
// them out. // them out.
...@@ -124,7 +125,8 @@ TEST_F(QuartcEndpointTest, DISABLED_ServerNegotiatesForOldVersion) { ...@@ -124,7 +125,8 @@ TEST_F(QuartcEndpointTest, DISABLED_ServerNegotiatesForOldVersion) {
// Tests that the server can accept connections from clients that use older // Tests that the server can accept connections from clients that use older
// QUIC versions. // QUIC versions.
TEST_F(QuartcEndpointTest, DISABLED_ServerAcceptsOldVersion) { TEST_F(QuartcEndpointTest,
QUIC_TEST_DISABLED_IN_CHROME(ServerAcceptsOldVersion)) {
// Note: for this test, we need support for two versions. Which two shouldn't // Note: for this test, we need support for two versions. Which two shouldn't
// matter, but they must be enabled so that the version manager doesn't filter // matter, but they must be enabled so that the version manager doesn't filter
// them out. // them out.
......
...@@ -12,48 +12,31 @@ ...@@ -12,48 +12,31 @@
// Usage: quic_packet_printer server|client <hex dump of packet> // Usage: quic_packet_printer server|client <hex dump of packet>
// //
// Example input: // Example input:
// quic_packet_printer server 0c6b810308320f24c004a939a38a2e3fd6ca589917f200400 // quic_packet_printer server 0c6b810308320f24c004a939a38a2e3fd6ca589917f200400201b80b0100501c0700060003023d0000001c00556e656e637279707465642073747265616d2064617461207365656e
// 201b80b0100501c0700060003023d0000001c00556e656e637279707465642073747265616d2
// 064617461207365656e
// //
// Example output: // Example output:
// OnPacket // OnPacket
// OnUnauthenticatedPublicHeader // OnUnauthenticatedPublicHeader
// OnUnauthenticatedHeader: { connection_id: 13845207862000976235, // OnUnauthenticatedHeader: { connection_id: 13845207862000976235, connection_id_length:8, packet_number_length:1, multipath_flag: 0, reset_flag: 0, version_flag: 0, path_id: , packet_number: 4 }
// connection_id_length:8, packet_number_length:1, multipath_flag: 0,
// reset_flag: 0, version_flag: 0, path_id: , packet_number: 4}
// OnDecryptedPacket // OnDecryptedPacket
// OnPacketHeader // OnPacketHeader
// OnAckFrame: largest_observed: 1 ack_delay_time: 3000 // OnAckFrame: largest_observed: 1 ack_delay_time: 3000 missing_packets: [ ] is_truncated: 0 received_packets: [ 1 at 466016 ]
// missing_packets: [ ] is_truncated: 0 received_packets: [ 1 at 466016 ]
// OnStopWaitingFrame // OnStopWaitingFrame
// OnConnectionCloseFrame: error_code { 61 } error_details { Unencrypted stream // OnConnectionCloseFrame: error_code { 61 } error_details { Unencrypted stream data seen }
// data seen }
// clang-format on // clang-format on
#include <iostream> #include <iostream>
#include <string>
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "net/third_party/quic/core/quic_framer.h" #include "net/third_party/quic/core/quic_framer.h"
#include "net/third_party/quic/core/quic_utils.h" #include "net/third_party/quic/core/quic_utils.h"
#include "net/third_party/quic/platform/api/quic_flags.h"
#include "net/third_party/quic/platform/api/quic_text_utils.h" #include "net/third_party/quic/platform/api/quic_text_utils.h"
// If set, specify the QUIC version to use. DEFINE_QUIC_COMMAND_LINE_FLAG(std::string,
quic::QuicString FLAGS_quic_version = ""; quic_version,
"",
namespace { "If set, specify the QUIC version to use.");
quic::QuicString ArgToString(base::CommandLine::StringType arg) {
#if defined(OS_WIN)
return base::UTF16ToASCII(arg);
#else
return arg;
#endif
}
} // namespace
namespace quic { namespace quic {
...@@ -224,40 +207,35 @@ class QuicPacketPrinter : public QuicFramerVisitorInterface { ...@@ -224,40 +207,35 @@ class QuicPacketPrinter : public QuicFramerVisitorInterface {
} // namespace quic } // namespace quic
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
base::CommandLine::Init(argc, argv); const char* usage = "Usage: quic_packet_printer client|server <hex>";
base::CommandLine* line = base::CommandLine::ForCurrentProcess(); std::vector<quic::QuicString> args =
const base::CommandLine::StringVector& args = line->GetArgs(); quic::QuicParseCommandLineFlags(usage, argc, argv);
if (args.size() != 3) { if (args.size() < 2) {
std::cerr << "Missing argument " << argc << ". (Usage: " << argv[0] quic::QuicPrintCommandLineFlagHelp(usage);
<< " client|server <hex>\n";
return 1; return 1;
} }
if (line->HasSwitch("quic_version")) { quic::QuicString perspective_string = args[0];
FLAGS_quic_version = line->GetSwitchValueASCII("quic_version");
}
quic::QuicString perspective_string = ArgToString(args[0]);
quic::Perspective perspective; quic::Perspective perspective;
if (perspective_string == "client") { if (perspective_string == "client") {
perspective = quic::Perspective::IS_CLIENT; perspective = quic::Perspective::IS_CLIENT;
} else if (perspective_string == "server") { } else if (perspective_string == "server") {
perspective = quic::Perspective::IS_SERVER; perspective = quic::Perspective::IS_SERVER;
} else { } else {
std::cerr << "Invalid perspective. " << perspective_string std::cerr << "Invalid perspective" << std::endl;
<< " Usage: " << args[0] << " client|server <hex>\n"; quic::QuicPrintCommandLineFlagHelp(usage);
return 1; return 1;
} }
quic::QuicString hex = quic::QuicTextUtils::HexDecode(argv[2]); quic::QuicString hex = quic::QuicTextUtils::HexDecode(args[1]);
quic::ParsedQuicVersionVector versions = quic::AllSupportedVersions(); quic::ParsedQuicVersionVector versions = quic::AllSupportedVersions();
// Fake a time since we're not actually generating acks. // Fake a time since we're not actually generating acks.
quic::QuicTime start(quic::QuicTime::Zero()); quic::QuicTime start(quic::QuicTime::Zero());
quic::QuicFramer framer(versions, start, perspective); quic::QuicFramer framer(versions, start, perspective);
if (!FLAGS_quic_version.empty()) { if (!GetQuicFlag(FLAGS_quic_version).empty()) {
for (quic::ParsedQuicVersion version : versions) { for (quic::ParsedQuicVersion version : versions) {
if (quic::QuicVersionToString(version.transport_version) == if (quic::QuicVersionToString(version.transport_version) ==
FLAGS_quic_version) { GetQuicFlag(FLAGS_quic_version)) {
framer.set_version(version); framer.set_version(version);
} }
} }
......
...@@ -7,28 +7,27 @@ ...@@ -7,28 +7,27 @@
#include <iostream> #include <iostream>
#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
#include "net/third_party/quic/core/crypto/crypto_handshake.h" #include "net/third_party/quic/core/crypto/crypto_handshake.h"
#include "net/third_party/quic/core/crypto/crypto_utils.h" #include "net/third_party/quic/core/crypto/crypto_utils.h"
#include "net/third_party/quic/platform/api/quic_flags.h"
#include "net/third_party/quic/platform/api/quic_text_utils.h"
using base::CommandLine;
using quic::HandshakeFailureReason;
using quic::CryptoUtils; using quic::CryptoUtils;
using quic::HandshakeFailureReason;
using quic::MAX_FAILURE_REASON; using quic::MAX_FAILURE_REASON;
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
CommandLine::Init(argc, argv); const char* usage = "Usage: quic_reject_reason_decoder <packed_reason>";
CommandLine* line = CommandLine::ForCurrentProcess(); std::vector<quic::QuicString> args =
const CommandLine::StringVector& args = line->GetArgs(); quic::QuicParseCommandLineFlags(usage, argc, argv);
if (args.size() != 1) { if (args.size() != 1) {
std::cerr << "Missing argument (Usage: " << argv[0] << " <packed_reason>\n"; std::cerr << usage << std::endl;
return 1; return 1;
} }
uint32_t packed_error = 0; uint32_t packed_error = 0;
if (!base::StringToUint(args[0], &packed_error)) { if (!quic::QuicTextUtils::StringToUint32(args[0], &packed_error)) {
std::cerr << "Unable to parse: " << args[0] << "\n"; std::cerr << "Unable to parse: " << args[0] << "\n";
return 2; return 2;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "net/third_party/quic/test_tools/fake_epoll_server.h" #include "net/tools/epoll_server/fake_epoll_server.h"
namespace quic { namespace quic {
namespace test { namespace test {
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef NET_THIRD_PARTY_QUIC_TEST_TOOLS_FAKE_EPOLL_SERVER_H_ #ifndef NET_TOOLS_EPOLL_SERVER_FAKE_EPOLL_SERVER_H_
#define NET_THIRD_PARTY_QUIC_TEST_TOOLS_FAKE_EPOLL_SERVER_H_ #define NET_TOOLS_EPOLL_SERVER_FAKE_EPOLL_SERVER_H_
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
...@@ -112,4 +112,4 @@ class FakeEpollServer : public FakeTimeEpollServer { ...@@ -112,4 +112,4 @@ class FakeEpollServer : public FakeTimeEpollServer {
} // namespace test } // namespace test
} // namespace quic } // namespace quic
#endif // NET_THIRD_PARTY_QUIC_TEST_TOOLS_FAKE_EPOLL_SERVER_H_ #endif // NET_TOOLS_EPOLL_SERVER_FAKE_EPOLL_SERVER_H_
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