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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 QuicCryptoStream::OnHandshakeMessage(message); | 100 QuicCryptoStream::OnHandshakeMessage(message); |
101 | 101 |
102 if (message.tag() == kSCUP) { | 102 if (message.tag() == kSCUP) { |
103 if (!handshake_confirmed()) { | 103 if (!handshake_confirmed()) { |
104 CloseConnection(QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE); | 104 CloseConnection(QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE); |
105 return; | 105 return; |
106 } | 106 } |
107 | 107 |
108 // |message| is an update from the server, so we treat it differently from a | 108 // |message| is an update from the server, so we treat it differently from a |
109 // handshake message. | 109 // handshake message. |
110 HandleServerConfigUpdateMessage(&message); | 110 HandleServerConfigUpdateMessage(message); |
111 return; | 111 return; |
112 } | 112 } |
113 | 113 |
114 // Do not process handshake messages after the handshake is confirmed. | 114 // Do not process handshake messages after the handshake is confirmed. |
115 if (handshake_confirmed()) { | 115 if (handshake_confirmed()) { |
116 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); | 116 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); |
117 return; | 117 return; |
118 } | 118 } |
119 | 119 |
120 DoHandshakeLoop(&message); | 120 DoHandshakeLoop(&message); |
121 } | 121 } |
122 | 122 |
123 bool QuicCryptoClientStream::CryptoConnect() { | 123 bool QuicCryptoClientStream::CryptoConnect() { |
124 next_state_ = STATE_INITIALIZE; | 124 next_state_ = STATE_INITIALIZE; |
125 DoHandshakeLoop(NULL); | 125 DoHandshakeLoop(NULL); |
126 return true; | 126 return true; |
127 } | 127 } |
128 | 128 |
129 int QuicCryptoClientStream::num_sent_client_hellos() const { | 129 int QuicCryptoClientStream::num_sent_client_hellos() const { |
130 return num_client_hellos_; | 130 return num_client_hellos_; |
131 } | 131 } |
132 | 132 |
133 bool QuicCryptoClientStream::WasChannelIDSent() const { | 133 bool QuicCryptoClientStream::WasChannelIDSent() const { |
134 return channel_id_sent_; | 134 return channel_id_sent_; |
135 } | 135 } |
136 | 136 |
137 void QuicCryptoClientStream::HandleServerConfigUpdateMessage( | 137 void QuicCryptoClientStream::HandleServerConfigUpdateMessage( |
138 const CryptoHandshakeMessage* in) { | 138 const CryptoHandshakeMessage& server_config_update) { |
139 DCHECK(in->tag() == kSCUP); | 139 DCHECK(server_config_update.tag() == kSCUP); |
140 string error_details; | 140 string error_details; |
141 QuicCryptoClientConfig::CachedState* cached = | 141 QuicCryptoClientConfig::CachedState* cached = |
142 crypto_config_->LookupOrCreate(server_id_); | 142 crypto_config_->LookupOrCreate(server_id_); |
143 QuicErrorCode error = crypto_config_->ProcessServerConfigUpdate( | 143 QuicErrorCode error = crypto_config_->ProcessServerConfigUpdate( |
144 *in, | 144 server_config_update, |
145 session()->connection()->clock()->WallNow(), | 145 session()->connection()->clock()->WallNow(), |
146 cached, | 146 cached, |
147 &crypto_negotiated_params_, | 147 &crypto_negotiated_params_, |
148 &error_details); | 148 &error_details); |
149 | 149 |
150 if (error != QUIC_NO_ERROR) { | 150 if (error != QUIC_NO_ERROR) { |
151 CloseConnectionWithDetails( | 151 CloseConnectionWithDetails( |
152 error, "Server config update invalid: " + error_details); | 152 error, "Server config update invalid: " + error_details); |
153 return; | 153 return; |
154 } | 154 } |
(...skipping 337 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 |