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/quic/quic_crypto_client_stream.h" | 5 #include "net/quic/quic_crypto_client_stream.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/profiler/scoped_tracker.h" |
8 #include "net/quic/crypto/crypto_protocol.h" | 9 #include "net/quic/crypto/crypto_protocol.h" |
9 #include "net/quic/crypto/crypto_utils.h" | 10 #include "net/quic/crypto/crypto_utils.h" |
10 #include "net/quic/crypto/null_encrypter.h" | 11 #include "net/quic/crypto/null_encrypter.h" |
11 #include "net/quic/quic_client_session_base.h" | 12 #include "net/quic/quic_client_session_base.h" |
12 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
13 #include "net/quic/quic_session.h" | 14 #include "net/quic/quic_session.h" |
14 | 15 |
15 using std::string; | 16 using std::string; |
16 | 17 |
17 namespace net { | 18 namespace net { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 116 |
116 // Do not process handshake messages after the handshake is confirmed. | 117 // Do not process handshake messages after the handshake is confirmed. |
117 if (handshake_confirmed()) { | 118 if (handshake_confirmed()) { |
118 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); | 119 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); |
119 return; | 120 return; |
120 } | 121 } |
121 | 122 |
122 DoHandshakeLoop(&message); | 123 DoHandshakeLoop(&message); |
123 } | 124 } |
124 | 125 |
125 bool QuicCryptoClientStream::CryptoConnect() { | 126 void QuicCryptoClientStream::CryptoConnect() { |
126 next_state_ = STATE_INITIALIZE; | 127 next_state_ = STATE_INITIALIZE; |
127 DoHandshakeLoop(nullptr); | 128 DoHandshakeLoop(nullptr); |
128 return true; | |
129 } | 129 } |
130 | 130 |
131 int QuicCryptoClientStream::num_sent_client_hellos() const { | 131 int QuicCryptoClientStream::num_sent_client_hellos() const { |
132 return num_client_hellos_; | 132 return num_client_hellos_; |
133 } | 133 } |
134 | 134 |
135 bool QuicCryptoClientStream::WasChannelIDSent() const { | 135 bool QuicCryptoClientStream::WasChannelIDSent() const { |
136 return channel_id_sent_; | 136 return channel_id_sent_; |
137 } | 137 } |
138 | 138 |
(...skipping 30 matching lines...) Expand all Loading... |
169 | 169 |
170 // kMaxClientHellos is the maximum number of times that we'll send a client | 170 // kMaxClientHellos is the maximum number of times that we'll send a client |
171 // hello. The value 3 accounts for: | 171 // hello. The value 3 accounts for: |
172 // * One failure due to an incorrect or missing source-address token. | 172 // * One failure due to an incorrect or missing source-address token. |
173 // * One failure due the server's certificate chain being unavailible and the | 173 // * One failure due the server's certificate chain being unavailible and the |
174 // server being unwilling to send it without a valid source-address token. | 174 // server being unwilling to send it without a valid source-address token. |
175 static const int kMaxClientHellos = 3; | 175 static const int kMaxClientHellos = 3; |
176 | 176 |
177 void QuicCryptoClientStream::DoHandshakeLoop( | 177 void QuicCryptoClientStream::DoHandshakeLoop( |
178 const CryptoHandshakeMessage* in) { | 178 const CryptoHandshakeMessage* in) { |
| 179 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 180 tracked_objects::ScopedTracker tracking_profile( |
| 181 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 182 "422516 QuicCryptoClientStream::DoHandshakeLoop")); |
| 183 |
179 QuicCryptoClientConfig::CachedState* cached = | 184 QuicCryptoClientConfig::CachedState* cached = |
180 crypto_config_->LookupOrCreate(server_id_); | 185 crypto_config_->LookupOrCreate(server_id_); |
181 | 186 |
182 QuicAsyncStatus rv = QUIC_SUCCESS; | 187 QuicAsyncStatus rv = QUIC_SUCCESS; |
183 do { | 188 do { |
184 CHECK_NE(STATE_NONE, next_state_); | 189 CHECK_NE(STATE_NONE, next_state_); |
185 const State state = next_state_; | 190 const State state = next_state_; |
186 next_state_ = STATE_IDLE; | 191 next_state_ = STATE_IDLE; |
187 rv = QUIC_SUCCESS; | 192 rv = QUIC_SUCCESS; |
188 switch (state) { | 193 switch (state) { |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 } | 600 } |
596 } | 601 } |
597 return false; | 602 return false; |
598 } | 603 } |
599 | 604 |
600 QuicClientSessionBase* QuicCryptoClientStream::client_session() { | 605 QuicClientSessionBase* QuicCryptoClientStream::client_session() { |
601 return reinterpret_cast<QuicClientSessionBase*>(session()); | 606 return reinterpret_cast<QuicClientSessionBase*>(session()); |
602 } | 607 } |
603 | 608 |
604 } // namespace net | 609 } // namespace net |
OLD | NEW |