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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 session()->connection()->SetAlternativeDecrypter( | 370 session()->connection()->SetAlternativeDecrypter( |
371 ENCRYPTION_INITIAL, | 371 ENCRYPTION_INITIAL, |
372 crypto_negotiated_params_.initial_crypters.decrypter.release(), | 372 crypto_negotiated_params_.initial_crypters.decrypter.release(), |
373 true /* latch once used */); | 373 true /* latch once used */); |
374 // Send subsequent packets under encryption on the assumption that the | 374 // Send subsequent packets under encryption on the assumption that the |
375 // server will accept the handshake. | 375 // server will accept the handshake. |
376 session()->connection()->SetEncrypter( | 376 session()->connection()->SetEncrypter( |
377 ENCRYPTION_INITIAL, | 377 ENCRYPTION_INITIAL, |
378 crypto_negotiated_params_.initial_crypters.encrypter.release()); | 378 crypto_negotiated_params_.initial_crypters.encrypter.release()); |
379 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); | 379 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); |
380 if (!encryption_established_) { | 380 |
| 381 if (FLAGS_quic_reply_to_rej) { |
| 382 // TODO(ianswett): Merge ENCRYPTION_REESTABLISHED and |
| 383 // ENCRYPTION_FIRST_ESTABLSIHED. |
381 encryption_established_ = true; | 384 encryption_established_ = true; |
382 session()->OnCryptoHandshakeEvent( | 385 session()->OnCryptoHandshakeEvent(QuicSession::ENCRYPTION_REESTABLISHED); |
383 QuicSession::ENCRYPTION_FIRST_ESTABLISHED); | |
384 } else { | 386 } else { |
385 session()->OnCryptoHandshakeEvent(QuicSession::ENCRYPTION_REESTABLISHED); | 387 if (!encryption_established_) { |
| 388 encryption_established_ = true; |
| 389 session()->OnCryptoHandshakeEvent( |
| 390 QuicSession::ENCRYPTION_FIRST_ESTABLISHED); |
| 391 } else { |
| 392 session()->OnCryptoHandshakeEvent(QuicSession::ENCRYPTION_REESTABLISHED); |
| 393 } |
386 } | 394 } |
387 } | 395 } |
388 | 396 |
389 void QuicCryptoClientStream::DoReceiveREJ( | 397 void QuicCryptoClientStream::DoReceiveREJ( |
390 const CryptoHandshakeMessage* in, | 398 const CryptoHandshakeMessage* in, |
391 QuicCryptoClientConfig::CachedState* cached) { | 399 QuicCryptoClientConfig::CachedState* cached) { |
392 // We sent a dummy CHLO because we didn't have enough information to | 400 // We sent a dummy CHLO because we didn't have enough information to |
393 // perform a handshake, or we sent a full hello that the server | 401 // perform a handshake, or we sent a full hello that the server |
394 // rejected. Here we hope to have a REJ that contains the information | 402 // rejected. Here we hope to have a REJ that contains the information |
395 // that we need. | 403 // that we need. |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 } | 684 } |
677 for (size_t i = 0; i < num_their_proof_demands; i++) { | 685 for (size_t i = 0; i < num_their_proof_demands; i++) { |
678 if (their_proof_demands[i] == kCHID) { | 686 if (their_proof_demands[i] == kCHID) { |
679 return true; | 687 return true; |
680 } | 688 } |
681 } | 689 } |
682 return false; | 690 return false; |
683 } | 691 } |
684 | 692 |
685 } // namespace net | 693 } // namespace net |
OLD | NEW |