| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/tools/quic/quic_client_base.h" | 5 #include "net/tools/quic/quic_client_base.h" |
| 6 | 6 |
| 7 #include "net/quic/crypto/quic_random.h" | 7 #include "net/quic/crypto/quic_random.h" |
| 8 #include "net/quic/quic_server_id.h" | 8 #include "net/quic/quic_server_id.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 namespace tools { | 11 namespace tools { |
| 12 | 12 |
| 13 QuicClientBase::QuicClientBase(const QuicServerId& server_id, | 13 QuicClientBase::QuicClientBase(const QuicServerId& server_id, |
| 14 const QuicVersionVector& supported_versions, | 14 const QuicVersionVector& supported_versions, |
| 15 const QuicConfig& config) | 15 const QuicConfig& config, |
| 16 ProofVerifier* proof_verifier) |
| 16 : server_id_(server_id), | 17 : server_id_(server_id), |
| 17 config_(config), | 18 config_(config), |
| 19 crypto_config_(proof_verifier), |
| 18 supported_versions_(supported_versions), | 20 supported_versions_(supported_versions), |
| 19 initial_max_packet_length_(0), | 21 initial_max_packet_length_(0), |
| 20 num_stateless_rejects_received_(0), | 22 num_stateless_rejects_received_(0), |
| 21 num_sent_client_hellos_(0), | 23 num_sent_client_hellos_(0), |
| 22 connection_error_(QUIC_NO_ERROR), | 24 connection_error_(QUIC_NO_ERROR), |
| 23 connected_or_attempting_connect_(false) {} | 25 connected_or_attempting_connect_(false) {} |
| 24 | 26 |
| 25 QuicClientBase::~QuicClientBase() {} | 27 QuicClientBase::~QuicClientBase() {} |
| 26 | 28 |
| 27 bool QuicClientBase::Initialize() { | 29 bool QuicClientBase::Initialize() { |
| 28 num_sent_client_hellos_ = 0; | 30 num_sent_client_hellos_ = 0; |
| 29 num_stateless_rejects_received_ = 0; | 31 num_stateless_rejects_received_ = 0; |
| 30 connection_error_ = QUIC_NO_ERROR; | 32 connection_error_ = QUIC_NO_ERROR; |
| 31 connected_or_attempting_connect_ = false; | 33 connected_or_attempting_connect_ = false; |
| 32 return true; | 34 return true; |
| 33 } | 35 } |
| 34 | 36 |
| 35 QuicClientBase::DummyPacketWriterFactory::DummyPacketWriterFactory( | 37 QuicClientBase::DummyPacketWriterFactory::DummyPacketWriterFactory( |
| 36 QuicPacketWriter* writer) | 38 QuicPacketWriter* writer) |
| 37 : writer_(writer) {} | 39 : writer_(writer) {} |
| 38 | 40 |
| 39 QuicClientBase::DummyPacketWriterFactory::~DummyPacketWriterFactory() {} | 41 QuicClientBase::DummyPacketWriterFactory::~DummyPacketWriterFactory() {} |
| 40 | 42 |
| 41 QuicPacketWriter* QuicClientBase::DummyPacketWriterFactory::Create( | 43 QuicPacketWriter* QuicClientBase::DummyPacketWriterFactory::Create( |
| 42 QuicConnection* /*connection*/) const { | 44 QuicConnection* /*connection*/) const { |
| 43 return writer_; | 45 return writer_; |
| 44 } | 46 } |
| 45 | 47 |
| 48 ProofVerifier* QuicClientBase::proof_verifier() const { |
| 49 return crypto_config_.proof_verifier(); |
| 50 } |
| 51 |
| 46 QuicClientSession* QuicClientBase::CreateQuicClientSession( | 52 QuicClientSession* QuicClientBase::CreateQuicClientSession( |
| 47 QuicConnection* connection) { | 53 QuicConnection* connection) { |
| 48 session_.reset( | 54 session_.reset( |
| 49 new QuicClientSession(config_, connection, server_id_, &crypto_config_)); | 55 new QuicClientSession(config_, connection, server_id_, &crypto_config_)); |
| 50 if (initial_max_packet_length_ != 0) { | 56 if (initial_max_packet_length_ != 0) { |
| 51 session()->connection()->SetMaxPacketLength(initial_max_packet_length_); | 57 session()->connection()->SetMaxPacketLength(initial_max_packet_length_); |
| 52 } | 58 } |
| 53 return session_.get(); | 59 return session_.get(); |
| 54 } | 60 } |
| 55 | 61 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 ? cached->GetNextServerDesignatedConnectionId() | 142 ? cached->GetNextServerDesignatedConnectionId() |
| 137 : 0; | 143 : 0; |
| 138 } | 144 } |
| 139 | 145 |
| 140 QuicConnectionId QuicClientBase::GenerateNewConnectionId() { | 146 QuicConnectionId QuicClientBase::GenerateNewConnectionId() { |
| 141 return QuicRandom::GetInstance()->RandUint64(); | 147 return QuicRandom::GetInstance()->RandUint64(); |
| 142 } | 148 } |
| 143 | 149 |
| 144 } // namespace tools | 150 } // namespace tools |
| 145 } // namespace net | 151 } // namespace net |
| OLD | NEW |