Chromium Code Reviews| 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 "net/quic/crypto/crypto_protocol.h" | 7 #include "net/quic/crypto/crypto_protocol.h" |
| 8 #include "net/quic/crypto/crypto_utils.h" | 8 #include "net/quic/crypto/crypto_utils.h" |
| 9 #include "net/quic/crypto/null_encrypter.h" | 9 #include "net/quic/crypto/null_encrypter.h" |
| 10 #include "net/quic/quic_client_session_base.h" | 10 #include "net/quic/quic_client_session_base.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 QuicCryptoStream::OnHandshakeMessage(message); | 99 QuicCryptoStream::OnHandshakeMessage(message); |
| 100 | 100 |
| 101 if (message.tag() == kSCUP) { | 101 if (message.tag() == kSCUP) { |
| 102 if (!handshake_confirmed()) { | 102 if (!handshake_confirmed()) { |
| 103 CloseConnection(QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE); | 103 CloseConnection(QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE); |
| 104 return; | 104 return; |
| 105 } | 105 } |
| 106 | 106 |
| 107 // |message| is an update from the server, so we treat it differently from a | 107 // |message| is an update from the server, so we treat it differently from a |
| 108 // handshake message. | 108 // handshake message. |
| 109 HandleServerConfigUpdateMessage(&message); | 109 HandleServerConfigUpdateMessage(message); |
| 110 return; | 110 return; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Do not process handshake messages after the handshake is confirmed. | 113 // Do not process handshake messages after the handshake is confirmed. |
| 114 if (handshake_confirmed()) { | 114 if (handshake_confirmed()) { |
| 115 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); | 115 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); |
| 116 return; | 116 return; |
| 117 } | 117 } |
| 118 | 118 |
| 119 DoHandshakeLoop(&message); | 119 DoHandshakeLoop(&message); |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool QuicCryptoClientStream::CryptoConnect() { | 122 bool QuicCryptoClientStream::CryptoConnect() { |
| 123 next_state_ = STATE_INITIALIZE; | 123 next_state_ = STATE_INITIALIZE; |
| 124 DoHandshakeLoop(NULL); | 124 DoHandshakeLoop(NULL); |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 | 127 |
| 128 int QuicCryptoClientStream::num_sent_client_hellos() const { | 128 int QuicCryptoClientStream::num_sent_client_hellos() const { |
| 129 return num_client_hellos_; | 129 return num_client_hellos_; |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool QuicCryptoClientStream::WasChannelIDSent() const { | 132 bool QuicCryptoClientStream::WasChannelIDSent() const { |
| 133 // TODO(rch): we should replace this with a boolean member so we | 133 // TODO(rch): we should replace this with a boolean member so we |
| 134 // can free the memory associated with the key after we're finished with it. | 134 // can free the memory associated with the key after we're finished with it. |
| 135 return channel_id_key_.get() != NULL; | 135 return channel_id_key_.get() != NULL; |
| 136 } | 136 } |
| 137 | 137 |
| 138 void QuicCryptoClientStream::HandleServerConfigUpdateMessage( | 138 void QuicCryptoClientStream::HandleServerConfigUpdateMessage( |
| 139 const CryptoHandshakeMessage* in) { | 139 const CryptoHandshakeMessage& in) { |
|
wtc
2014/07/16 20:42:46
Nit: please name the input "server_config_update".
ramant (doing other things)
2014/07/16 22:31:40
Done.
| |
| 140 DCHECK(in->tag() == kSCUP); | 140 DCHECK(in.tag() == kSCUP); |
| 141 string error_details; | 141 string error_details; |
| 142 QuicCryptoClientConfig::CachedState* cached = | 142 QuicCryptoClientConfig::CachedState* cached = |
| 143 crypto_config_->LookupOrCreate(server_id_); | 143 crypto_config_->LookupOrCreate(server_id_); |
| 144 QuicErrorCode error = crypto_config_->ProcessServerConfigUpdate( | 144 QuicErrorCode error = crypto_config_->ProcessServerConfigUpdate( |
| 145 *in, | 145 in, |
| 146 session()->connection()->clock()->WallNow(), | 146 session()->connection()->clock()->WallNow(), |
| 147 cached, | 147 cached, |
| 148 &crypto_negotiated_params_, | 148 &crypto_negotiated_params_, |
| 149 &error_details); | 149 &error_details); |
| 150 | 150 |
| 151 if (error != QUIC_NO_ERROR) { | 151 if (error != QUIC_NO_ERROR) { |
| 152 CloseConnectionWithDetails( | 152 CloseConnectionWithDetails( |
| 153 error, "Server config update invalid: " + error_details); | 153 error, "Server config update invalid: " + error_details); |
| 154 return; | 154 return; |
| 155 } | 155 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 } | 492 } |
| 493 } | 493 } |
| 494 return false; | 494 return false; |
| 495 } | 495 } |
| 496 | 496 |
| 497 QuicClientSessionBase* QuicCryptoClientStream::client_session() { | 497 QuicClientSessionBase* QuicCryptoClientStream::client_session() { |
| 498 return reinterpret_cast<QuicClientSessionBase*>(session()); | 498 return reinterpret_cast<QuicClientSessionBase*>(session()); |
| 499 } | 499 } |
| 500 | 500 |
| 501 } // namespace net | 501 } // namespace net |
| OLD | NEW |