| 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 <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 ENCRYPTION_INITIAL, | 383 ENCRYPTION_INITIAL, |
| 384 crypto_negotiated_params_.initial_crypters.decrypter.release(), | 384 crypto_negotiated_params_.initial_crypters.decrypter.release(), |
| 385 true /* latch once used */); | 385 true /* latch once used */); |
| 386 // Send subsequent packets under encryption on the assumption that the | 386 // Send subsequent packets under encryption on the assumption that the |
| 387 // server will accept the handshake. | 387 // server will accept the handshake. |
| 388 session()->connection()->SetEncrypter( | 388 session()->connection()->SetEncrypter( |
| 389 ENCRYPTION_INITIAL, | 389 ENCRYPTION_INITIAL, |
| 390 crypto_negotiated_params_.initial_crypters.encrypter.release()); | 390 crypto_negotiated_params_.initial_crypters.encrypter.release()); |
| 391 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); | 391 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_INITIAL); |
| 392 | 392 |
| 393 if (FLAGS_quic_reply_to_rej) { | 393 // TODO(ianswett): Merge ENCRYPTION_REESTABLISHED and |
| 394 // TODO(ianswett): Merge ENCRYPTION_REESTABLISHED and | 394 // ENCRYPTION_FIRST_ESTABLSIHED |
| 395 // ENCRYPTION_FIRST_ESTABLSIHED. | 395 encryption_established_ = true; |
| 396 encryption_established_ = true; | 396 session()->OnCryptoHandshakeEvent(QuicSession::ENCRYPTION_REESTABLISHED); |
| 397 session()->OnCryptoHandshakeEvent(QuicSession::ENCRYPTION_REESTABLISHED); | |
| 398 } else { | |
| 399 if (!encryption_established_) { | |
| 400 encryption_established_ = true; | |
| 401 session()->OnCryptoHandshakeEvent( | |
| 402 QuicSession::ENCRYPTION_FIRST_ESTABLISHED); | |
| 403 } else { | |
| 404 session()->OnCryptoHandshakeEvent(QuicSession::ENCRYPTION_REESTABLISHED); | |
| 405 } | |
| 406 } | |
| 407 } | 397 } |
| 408 | 398 |
| 409 void QuicCryptoClientStream::DoReceiveREJ( | 399 void QuicCryptoClientStream::DoReceiveREJ( |
| 410 const CryptoHandshakeMessage* in, | 400 const CryptoHandshakeMessage* in, |
| 411 QuicCryptoClientConfig::CachedState* cached) { | 401 QuicCryptoClientConfig::CachedState* cached) { |
| 412 // We sent a dummy CHLO because we didn't have enough information to | 402 // We sent a dummy CHLO because we didn't have enough information to |
| 413 // perform a handshake, or we sent a full hello that the server | 403 // perform a handshake, or we sent a full hello that the server |
| 414 // rejected. Here we hope to have a REJ that contains the information | 404 // rejected. Here we hope to have a REJ that contains the information |
| 415 // that we need. | 405 // that we need. |
| 416 if ((in->tag() != kREJ) && (in->tag() != kSREJ)) { | 406 if ((in->tag() != kREJ) && (in->tag() != kSREJ)) { |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 } | 686 } |
| 697 for (size_t i = 0; i < num_their_proof_demands; i++) { | 687 for (size_t i = 0; i < num_their_proof_demands; i++) { |
| 698 if (their_proof_demands[i] == kCHID) { | 688 if (their_proof_demands[i] == kCHID) { |
| 699 return true; | 689 return true; |
| 700 } | 690 } |
| 701 } | 691 } |
| 702 return false; | 692 return false; |
| 703 } | 693 } |
| 704 | 694 |
| 705 } // namespace net | 695 } // namespace net |
| OLD | NEW |