diff options
author | rtenneti <rtenneti@chromium.org> | 2015-08-14 13:47:47 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-14 20:48:47 +0000 |
commit | c40ba9f6df3d590a17389c646a3a89a82a186a48 (patch) | |
tree | c0baa706923e9700384a681499d38cfc94c5d922 /net | |
parent | 58423c13595e87949813b6f86a2f0f8ffd116740 (diff) | |
download | chromium_src-c40ba9f6df3d590a17389c646a3a89a82a186a48.zip chromium_src-c40ba9f6df3d590a17389c646a3a89a82a186a48.tar.gz chromium_src-c40ba9f6df3d590a17389c646a3a89a82a186a48.tar.bz2 |
QUIC - bug fix for quic_client - start the packet_reader if it is not
started. Fix provided by Dmitry Adamushko <dmitry.adamushko@gmail.com>.
R=rch@chromium.org
Review URL: https://codereview.chromium.org/1295853002
Cr-Commit-Position: refs/heads/master@{#343487}
Diffstat (limited to 'net')
-rw-r--r-- | net/tools/quic/quic_simple_client.cc | 13 | ||||
-rw-r--r-- | net/tools/quic/quic_simple_client.h | 4 |
2 files changed, 15 insertions, 2 deletions
diff --git a/net/tools/quic/quic_simple_client.cc b/net/tools/quic/quic_simple_client.cc index e22eed9..261086b 100644 --- a/net/tools/quic/quic_simple_client.cc +++ b/net/tools/quic/quic_simple_client.cc @@ -43,8 +43,8 @@ QuicSimpleClient::QuicSimpleClient(IPEndPoint server_address, helper_(CreateQuicConnectionHelper()), initialized_(false), supported_versions_(supported_versions), - weak_factory_(this) { -} + packet_reader_started_(false), + weak_factory_(this) {} QuicSimpleClient::QuicSimpleClient(IPEndPoint server_address, const QuicServerId& server_id, @@ -62,6 +62,7 @@ QuicSimpleClient::QuicSimpleClient(IPEndPoint server_address, num_sent_client_hellos_(0), connection_error_(QUIC_NO_ERROR), connected_or_attempting_connect_(false), + packet_reader_started_(false), weak_factory_(this) {} QuicSimpleClient::~QuicSimpleClient() { @@ -166,12 +167,20 @@ bool QuicSimpleClient::CreateUDPSocket() { return true; } +void QuicSimpleClient::StartPacketReaderIfNotStarted() { + if (!packet_reader_started_) { + packet_reader_->StartReading(); + packet_reader_started_ = true; + } +} + bool QuicSimpleClient::Connect() { // Attempt multiple connects until the maximum number of client hellos have // been sent. while (!connected() && GetNumSentClientHellos() <= QuicCryptoClientStream::kMaxClientHellos) { StartConnect(); + StartPacketReaderIfNotStarted(); while (EncryptionBeingEstablished()) { WaitForEvents(); } diff --git a/net/tools/quic/quic_simple_client.h b/net/tools/quic/quic_simple_client.h index b8be29b..b94f8c2 100644 --- a/net/tools/quic/quic_simple_client.h +++ b/net/tools/quic/quic_simple_client.h @@ -314,6 +314,8 @@ class QuicSimpleClient : public QuicDataStream::Visitor, // Read a UDP packet and hand it to the framer. bool ReadAndProcessPacket(); + void StartPacketReaderIfNotStarted(); + // Used by |helper_| to time alarms. QuicClock clock_; @@ -419,6 +421,8 @@ class QuicSimpleClient : public QuicDataStream::Visitor, scoped_ptr<QuicPacketReader> packet_reader_; + bool packet_reader_started_; + base::WeakPtrFactory<QuicSimpleClient> weak_factory_; DISALLOW_COPY_AND_ASSIGN(QuicSimpleClient); |