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