| 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_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "net/quic/crypto/crypto_protocol.h" | 8 #include "net/quic/crypto/crypto_protocol.h" |
| 9 #include "net/quic/crypto/crypto_utils.h" | 9 #include "net/quic/crypto/crypto_utils.h" |
| 10 #include "net/quic/crypto/null_encrypter.h" | 10 #include "net/quic/crypto/null_encrypter.h" |
| 11 #include "net/quic/quic_client_session_base.h" | 11 #include "net/quic/quic_client_session_base.h" |
| 12 #include "net/quic/quic_flags.h" | 12 #include "net/quic/quic_flags.h" |
| 13 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
| 14 #include "net/quic/quic_session.h" | 14 #include "net/quic/quic_session.h" |
| 15 | 15 |
| 16 using std::string; | 16 using std::string; |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 QuicCryptoClientStreamBase::QuicCryptoClientStreamBase( |
| 21 QuicClientSessionBase* session) |
| 22 : QuicCryptoStream(session) { |
| 23 } |
| 24 |
| 20 QuicCryptoClientStream::ChannelIDSourceCallbackImpl:: | 25 QuicCryptoClientStream::ChannelIDSourceCallbackImpl:: |
| 21 ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream) | 26 ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream) |
| 22 : stream_(stream) {} | 27 : stream_(stream) {} |
| 23 | 28 |
| 24 QuicCryptoClientStream::ChannelIDSourceCallbackImpl:: | 29 QuicCryptoClientStream::ChannelIDSourceCallbackImpl:: |
| 25 ~ChannelIDSourceCallbackImpl() {} | 30 ~ChannelIDSourceCallbackImpl() {} |
| 26 | 31 |
| 27 void QuicCryptoClientStream::ChannelIDSourceCallbackImpl::Run( | 32 void QuicCryptoClientStream::ChannelIDSourceCallbackImpl::Run( |
| 28 scoped_ptr<ChannelIDKey>* channel_id_key) { | 33 scoped_ptr<ChannelIDKey>* channel_id_key) { |
| 29 if (stream_ == nullptr) { | 34 if (stream_ == nullptr) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 75 |
| 71 void QuicCryptoClientStream::ProofVerifierCallbackImpl::Cancel() { | 76 void QuicCryptoClientStream::ProofVerifierCallbackImpl::Cancel() { |
| 72 stream_ = nullptr; | 77 stream_ = nullptr; |
| 73 } | 78 } |
| 74 | 79 |
| 75 QuicCryptoClientStream::QuicCryptoClientStream( | 80 QuicCryptoClientStream::QuicCryptoClientStream( |
| 76 const QuicServerId& server_id, | 81 const QuicServerId& server_id, |
| 77 QuicClientSessionBase* session, | 82 QuicClientSessionBase* session, |
| 78 ProofVerifyContext* verify_context, | 83 ProofVerifyContext* verify_context, |
| 79 QuicCryptoClientConfig* crypto_config) | 84 QuicCryptoClientConfig* crypto_config) |
| 80 : QuicCryptoStream(session), | 85 : QuicCryptoClientStreamBase(session), |
| 81 next_state_(STATE_IDLE), | 86 next_state_(STATE_IDLE), |
| 82 num_client_hellos_(0), | 87 num_client_hellos_(0), |
| 83 crypto_config_(crypto_config), | 88 crypto_config_(crypto_config), |
| 84 server_id_(server_id), | 89 server_id_(server_id), |
| 85 generation_counter_(0), | 90 generation_counter_(0), |
| 86 channel_id_sent_(false), | 91 channel_id_sent_(false), |
| 87 channel_id_source_callback_run_(false), | 92 channel_id_source_callback_run_(false), |
| 88 channel_id_source_callback_(nullptr), | 93 channel_id_source_callback_(nullptr), |
| 89 verify_context_(verify_context), | 94 verify_context_(verify_context), |
| 90 proof_verify_callback_(nullptr), | 95 proof_verify_callback_(nullptr), |
| 91 stateless_reject_received_(false) { | 96 stateless_reject_received_(false) { |
| 92 DCHECK_EQ(Perspective::IS_CLIENT, session->connection()->perspective()); | 97 DCHECK_EQ(Perspective::IS_CLIENT, session->connection()->perspective()); |
| 93 } | 98 } |
| 94 | 99 |
| 95 QuicCryptoClientStream::~QuicCryptoClientStream() { | 100 QuicCryptoClientStream::~QuicCryptoClientStream() { |
| 96 if (channel_id_source_callback_) { | 101 if (channel_id_source_callback_) { |
| 97 channel_id_source_callback_->Cancel(); | 102 channel_id_source_callback_->Cancel(); |
| 98 } | 103 } |
| 99 if (proof_verify_callback_) { | 104 if (proof_verify_callback_) { |
| 100 proof_verify_callback_->Cancel(); | 105 proof_verify_callback_->Cancel(); |
| 101 } | 106 } |
| 102 } | 107 } |
| 103 | 108 |
| 104 void QuicCryptoClientStream::OnHandshakeMessage( | 109 void QuicCryptoClientStream::OnHandshakeMessage( |
| 105 const CryptoHandshakeMessage& message) { | 110 const CryptoHandshakeMessage& message) { |
| 106 QuicCryptoStream::OnHandshakeMessage(message); | 111 QuicCryptoClientStreamBase::OnHandshakeMessage(message); |
| 107 | 112 |
| 108 if (message.tag() == kSCUP) { | 113 if (message.tag() == kSCUP) { |
| 109 if (!handshake_confirmed()) { | 114 if (!handshake_confirmed()) { |
| 110 CloseConnection(QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE); | 115 CloseConnection(QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE); |
| 111 return; | 116 return; |
| 112 } | 117 } |
| 113 | 118 |
| 114 // |message| is an update from the server, so we treat it differently from a | 119 // |message| is an update from the server, so we treat it differently from a |
| 115 // handshake message. | 120 // handshake message. |
| 116 HandleServerConfigUpdateMessage(message); | 121 HandleServerConfigUpdateMessage(message); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 } | 617 } |
| 613 } | 618 } |
| 614 return false; | 619 return false; |
| 615 } | 620 } |
| 616 | 621 |
| 617 QuicClientSessionBase* QuicCryptoClientStream::client_session() { | 622 QuicClientSessionBase* QuicCryptoClientStream::client_session() { |
| 618 return reinterpret_cast<QuicClientSessionBase*>(session()); | 623 return reinterpret_cast<QuicClientSessionBase*>(session()); |
| 619 } | 624 } |
| 620 | 625 |
| 621 } // namespace net | 626 } // namespace net |
| OLD | NEW |