| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // perform a handshake, or we sent a full hello that the server | 381 // perform a handshake, or we sent a full hello that the server |
| 382 // rejected. Here we hope to have a REJ that contains the information | 382 // rejected. Here we hope to have a REJ that contains the information |
| 383 // that we need. | 383 // that we need. |
| 384 if ((in->tag() != kREJ) && (in->tag() != kSREJ)) { | 384 if ((in->tag() != kREJ) && (in->tag() != kSREJ)) { |
| 385 next_state_ = STATE_NONE; | 385 next_state_ = STATE_NONE; |
| 386 CloseConnectionWithDetails(QUIC_INVALID_CRYPTO_MESSAGE_TYPE, | 386 CloseConnectionWithDetails(QUIC_INVALID_CRYPTO_MESSAGE_TYPE, |
| 387 "Expected REJ"); | 387 "Expected REJ"); |
| 388 return; | 388 return; |
| 389 } | 389 } |
| 390 | 390 |
| 391 const uint32* reject_reasons; | 391 const uint32_t* reject_reasons; |
| 392 size_t num_reject_reasons; | 392 size_t num_reject_reasons; |
| 393 static_assert(sizeof(QuicTag) == sizeof(uint32), "header out of sync"); | 393 static_assert(sizeof(QuicTag) == sizeof(uint32_t), "header out of sync"); |
| 394 if (in->GetTaglist(kRREJ, &reject_reasons, &num_reject_reasons) == | 394 if (in->GetTaglist(kRREJ, &reject_reasons, &num_reject_reasons) == |
| 395 QUIC_NO_ERROR) { | 395 QUIC_NO_ERROR) { |
| 396 uint32 packed_error = 0; | 396 uint32_t packed_error = 0; |
| 397 for (size_t i = 0; i < num_reject_reasons; ++i) { | 397 for (size_t i = 0; i < num_reject_reasons; ++i) { |
| 398 // HANDSHAKE_OK is 0 and don't report that as error. | 398 // HANDSHAKE_OK is 0 and don't report that as error. |
| 399 if (reject_reasons[i] == HANDSHAKE_OK || reject_reasons[i] >= 32) { | 399 if (reject_reasons[i] == HANDSHAKE_OK || reject_reasons[i] >= 32) { |
| 400 continue; | 400 continue; |
| 401 } | 401 } |
| 402 HandshakeFailureReason reason = | 402 HandshakeFailureReason reason = |
| 403 static_cast<HandshakeFailureReason>(reject_reasons[i]); | 403 static_cast<HandshakeFailureReason>(reject_reasons[i]); |
| 404 packed_error |= 1 << (reason - 1); | 404 packed_error |= 1 << (reason - 1); |
| 405 } | 405 } |
| 406 DVLOG(1) << "Reasons for rejection: " << packed_error; | 406 DVLOG(1) << "Reasons for rejection: " << packed_error; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 } | 663 } |
| 664 } | 664 } |
| 665 return false; | 665 return false; |
| 666 } | 666 } |
| 667 | 667 |
| 668 QuicClientSessionBase* QuicCryptoClientStream::client_session() { | 668 QuicClientSessionBase* QuicCryptoClientStream::client_session() { |
| 669 return reinterpret_cast<QuicClientSessionBase*>(session()); | 669 return reinterpret_cast<QuicClientSessionBase*>(session()); |
| 670 } | 670 } |
| 671 | 671 |
| 672 } // namespace net | 672 } // namespace net |
| OLD | NEW |