OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_session.h" | 5 #include "net/tools/quic/quic_client_session.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/quic/crypto/crypto_protocol.h" | 8 #include "net/quic/crypto/crypto_protocol.h" |
9 #include "net/quic/crypto/proof_verifier_chromium.h" | 9 #include "net/quic/crypto/proof_verifier_chromium.h" |
10 #include "net/quic/quic_server_id.h" | 10 #include "net/quic/quic_server_id.h" |
11 #include "net/tools/quic/quic_spdy_client_stream.h" | 11 #include "net/tools/quic/quic_spdy_client_stream.h" |
12 | 12 |
13 using std::string; | 13 using std::string; |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 namespace tools { | 16 namespace tools { |
17 | 17 |
18 QuicClientSession::QuicClientSession(const QuicConfig& config, | 18 QuicClientSession::QuicClientSession(const QuicConfig& config, |
19 QuicConnection* connection, | 19 QuicConnection* connection, |
20 const QuicServerId& server_id, | 20 const QuicServerId& server_id, |
21 QuicCryptoClientConfig* crypto_config) | 21 QuicCryptoClientConfig* crypto_config) |
22 : QuicClientSessionBase(connection, config), | 22 : QuicClientSessionBase(connection, config), |
23 crypto_stream_(new QuicCryptoClientStream( | 23 server_id_(server_id), |
24 server_id, | 24 crypto_config_(crypto_config), |
25 this, | 25 respect_goaway_(true) {} |
26 new ProofVerifyContextChromium(0, BoundNetLog()), | 26 |
27 crypto_config)), | 27 QuicClientSession::~QuicClientSession() { |
28 respect_goaway_(true) { | |
29 } | 28 } |
30 | 29 |
31 QuicClientSession::~QuicClientSession() { | 30 void QuicClientSession::Initialize() { |
| 31 crypto_stream_.reset(CreateQuicCryptoStream()); |
| 32 QuicClientSessionBase::Initialize(); |
32 } | 33 } |
33 | 34 |
34 void QuicClientSession::OnProofValid( | 35 void QuicClientSession::OnProofValid( |
35 const QuicCryptoClientConfig::CachedState& /*cached*/) {} | 36 const QuicCryptoClientConfig::CachedState& /*cached*/) {} |
36 | 37 |
37 void QuicClientSession::OnProofVerifyDetailsAvailable( | 38 void QuicClientSession::OnProofVerifyDetailsAvailable( |
38 const ProofVerifyDetails& /*verify_details*/) {} | 39 const ProofVerifyDetails& /*verify_details*/) {} |
39 | 40 |
40 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDynamicStream() { | 41 QuicSpdyClientStream* QuicClientSession::CreateOutgoingDynamicStream() { |
41 if (!crypto_stream_->encryption_established()) { | 42 if (!crypto_stream_->encryption_established()) { |
(...skipping 12 matching lines...) Expand all Loading... |
54 } | 55 } |
55 QuicSpdyClientStream* stream = CreateClientStream(); | 56 QuicSpdyClientStream* stream = CreateClientStream(); |
56 ActivateStream(stream); | 57 ActivateStream(stream); |
57 return stream; | 58 return stream; |
58 } | 59 } |
59 | 60 |
60 QuicSpdyClientStream* QuicClientSession::CreateClientStream() { | 61 QuicSpdyClientStream* QuicClientSession::CreateClientStream() { |
61 return new QuicSpdyClientStream(GetNextOutgoingStreamId(), this); | 62 return new QuicSpdyClientStream(GetNextOutgoingStreamId(), this); |
62 } | 63 } |
63 | 64 |
64 QuicCryptoClientStream* QuicClientSession::GetCryptoStream() { | 65 QuicCryptoClientStreamBase* QuicClientSession::GetCryptoStream() { |
65 return crypto_stream_.get(); | 66 return crypto_stream_.get(); |
66 } | 67 } |
67 | 68 |
68 void QuicClientSession::CryptoConnect() { | 69 void QuicClientSession::CryptoConnect() { |
69 DCHECK(flow_controller()); | 70 DCHECK(flow_controller()); |
70 crypto_stream_->CryptoConnect(); | 71 crypto_stream_->CryptoConnect(); |
71 } | 72 } |
72 | 73 |
73 int QuicClientSession::GetNumSentClientHellos() const { | 74 int QuicClientSession::GetNumSentClientHellos() const { |
74 return crypto_stream_->num_sent_client_hellos(); | 75 return crypto_stream_->num_sent_client_hellos(); |
75 } | 76 } |
76 | 77 |
77 QuicSpdyStream* QuicClientSession::CreateIncomingDynamicStream( | 78 QuicSpdyStream* QuicClientSession::CreateIncomingDynamicStream( |
78 QuicStreamId id) { | 79 QuicStreamId id) { |
79 DLOG(ERROR) << "Server push not supported"; | 80 DLOG(ERROR) << "Server push not supported"; |
80 return nullptr; | 81 return nullptr; |
81 } | 82 } |
82 | 83 |
| 84 QuicCryptoClientStreamBase* QuicClientSession::CreateQuicCryptoStream() { |
| 85 return new QuicCryptoClientStream( |
| 86 server_id_, this, new ProofVerifyContextChromium(0, BoundNetLog()), |
| 87 crypto_config_); |
| 88 } |
| 89 |
83 } // namespace tools | 90 } // namespace tools |
| 91 |
84 } // namespace net | 92 } // namespace net |
OLD | NEW |