Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Side by Side Diff: net/quic/quic_crypto_server_stream.cc

Issue 490263003: When talking >=QUIC_VERSION_22, regularly send updated bandwidth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_server_stream.h" 5 #include "net/quic/quic_crypto_server_stream.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "crypto/secure_hash.h" 8 #include "crypto/secure_hash.h"
9 #include "net/quic/crypto/crypto_protocol.h" 9 #include "net/quic/crypto/crypto_protocol.h"
10 #include "net/quic/crypto/crypto_utils.h" 10 #include "net/quic/crypto/crypto_utils.h"
11 #include "net/quic/crypto/quic_crypto_server_config.h" 11 #include "net/quic/crypto/quic_crypto_server_config.h"
12 #include "net/quic/crypto/source_address_token.h"
12 #include "net/quic/quic_config.h" 13 #include "net/quic/quic_config.h"
13 #include "net/quic/quic_protocol.h" 14 #include "net/quic/quic_protocol.h"
14 #include "net/quic/quic_session.h" 15 #include "net/quic/quic_session.h"
15 16
16 namespace net { 17 namespace net {
17 18
18 void ServerHelloNotifier::OnAckNotification( 19 void ServerHelloNotifier::OnAckNotification(
19 int num_original_packets, 20 int num_original_packets,
20 int num_original_bytes, 21 int num_original_bytes,
21 int num_retransmitted_packets, 22 int num_retransmitted_packets,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 session()->connection()->SetAlternativeDecrypter( 146 session()->connection()->SetAlternativeDecrypter(
146 crypto_negotiated_params_.forward_secure_crypters.decrypter.release(), 147 crypto_negotiated_params_.forward_secure_crypters.decrypter.release(),
147 ENCRYPTION_FORWARD_SECURE, false /* don't latch */); 148 ENCRYPTION_FORWARD_SECURE, false /* don't latch */);
148 149
149 encryption_established_ = true; 150 encryption_established_ = true;
150 handshake_confirmed_ = true; 151 handshake_confirmed_ = true;
151 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED); 152 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
152 153
153 // Now that the handshake is complete, send an updated server config and 154 // Now that the handshake is complete, send an updated server config and
154 // source-address token to the client. 155 // source-address token to the client.
155 SendServerConfigUpdate(); 156 SendServerConfigUpdate(NULL);
156 } 157 }
157 158
158 void QuicCryptoServerStream::SendServerConfigUpdate() { 159 void QuicCryptoServerStream::SendServerConfigUpdate(
160 const CachedNetworkParameters* cached_network_params) {
159 if (session()->connection()->version() <= QUIC_VERSION_21) { 161 if (session()->connection()->version() <= QUIC_VERSION_21) {
160 return; 162 return;
161 } 163 }
162 164
163 CryptoHandshakeMessage server_config_update_message; 165 CryptoHandshakeMessage server_config_update_message;
164 if (!crypto_config_.BuildServerConfigUpdateMessage( 166 if (!crypto_config_.BuildServerConfigUpdateMessage(
165 session()->connection()->peer_address(), 167 session()->connection()->peer_address(),
166 session()->connection()->clock(), 168 session()->connection()->clock(),
167 session()->connection()->random_generator(), 169 session()->connection()->random_generator(),
168 crypto_negotiated_params_, &server_config_update_message)) { 170 crypto_negotiated_params_,
171 cached_network_params,
172 &server_config_update_message)) {
169 DVLOG(1) << "Server: Failed to build server config update (SCUP)!"; 173 DVLOG(1) << "Server: Failed to build server config update (SCUP)!";
170 return; 174 return;
171 } 175 }
172 176
173 DVLOG(1) << "Server: Sending server config update: " 177 DVLOG(1) << "Server: Sending server config update: "
174 << server_config_update_message.DebugString(); 178 << server_config_update_message.DebugString();
175 const QuicData& data = server_config_update_message.GetSerialized(); 179 const QuicData& data = server_config_update_message.GetSerialized();
176 WriteOrBufferData(string(data.data(), data.length()), false, NULL); 180 WriteOrBufferData(string(data.data(), data.length()), false, NULL);
177 181
178 ++num_server_config_update_messages_sent_; 182 ++num_server_config_update_messages_sent_;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 245
242 void QuicCryptoServerStream::ValidateCallback::RunImpl( 246 void QuicCryptoServerStream::ValidateCallback::RunImpl(
243 const CryptoHandshakeMessage& client_hello, 247 const CryptoHandshakeMessage& client_hello,
244 const Result& result) { 248 const Result& result) {
245 if (parent_ != NULL) { 249 if (parent_ != NULL) {
246 parent_->FinishProcessingHandshakeMessage(client_hello, result); 250 parent_->FinishProcessingHandshakeMessage(client_hello, result);
247 } 251 }
248 } 252 }
249 253
250 } // namespace net 254 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698