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

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

Issue 2873883002: Add QUIC handshake accounting. Protected by (Closed)
Patch Set: Created 3 years, 7 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/core/quic_crypto_server_stream.h" 5 #include "net/quic/core/quic_crypto_server_stream.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "net/quic/core/crypto/crypto_protocol.h" 9 #include "net/quic/core/crypto/crypto_protocol.h"
10 #include "net/quic/core/crypto/crypto_utils.h" 10 #include "net/quic/core/crypto/crypto_utils.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 compressed_certs_cache_(compressed_certs_cache), 90 compressed_certs_cache_(compressed_certs_cache),
91 signed_config_(new QuicSignedServerConfig), 91 signed_config_(new QuicSignedServerConfig),
92 helper_(helper), 92 helper_(helper),
93 num_handshake_messages_(0), 93 num_handshake_messages_(0),
94 num_handshake_messages_with_server_nonces_(0), 94 num_handshake_messages_with_server_nonces_(0),
95 send_server_config_update_cb_(nullptr), 95 send_server_config_update_cb_(nullptr),
96 num_server_config_update_messages_sent_(0), 96 num_server_config_update_messages_sent_(0),
97 use_stateless_rejects_if_peer_supported_( 97 use_stateless_rejects_if_peer_supported_(
98 use_stateless_rejects_if_peer_supported), 98 use_stateless_rejects_if_peer_supported),
99 peer_supports_stateless_rejects_(false), 99 peer_supports_stateless_rejects_(false),
100 zero_rtt_attempted_(false),
100 chlo_packet_size_(0), 101 chlo_packet_size_(0),
101 validate_client_hello_cb_(nullptr), 102 validate_client_hello_cb_(nullptr),
102 process_client_hello_cb_(nullptr) { 103 process_client_hello_cb_(nullptr) {
103 DCHECK_EQ(Perspective::IS_SERVER, session->connection()->perspective()); 104 DCHECK_EQ(Perspective::IS_SERVER, session->connection()->perspective());
104 } 105 }
105 106
106 QuicCryptoServerStream::~QuicCryptoServerStream() { 107 QuicCryptoServerStream::~QuicCryptoServerStream() {
107 CancelOutstandingCallbacks(); 108 CancelOutstandingCallbacks();
108 } 109 }
109 110
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 367 }
367 368
368 bool QuicCryptoServerStream::UseStatelessRejectsIfPeerSupported() const { 369 bool QuicCryptoServerStream::UseStatelessRejectsIfPeerSupported() const {
369 return use_stateless_rejects_if_peer_supported_; 370 return use_stateless_rejects_if_peer_supported_;
370 } 371 }
371 372
372 bool QuicCryptoServerStream::PeerSupportsStatelessRejects() const { 373 bool QuicCryptoServerStream::PeerSupportsStatelessRejects() const {
373 return peer_supports_stateless_rejects_; 374 return peer_supports_stateless_rejects_;
374 } 375 }
375 376
377 bool QuicCryptoServerStream::ZeroRttAttempted() const {
378 return zero_rtt_attempted_;
379 }
380
376 void QuicCryptoServerStream::SetPeerSupportsStatelessRejects( 381 void QuicCryptoServerStream::SetPeerSupportsStatelessRejects(
377 bool peer_supports_stateless_rejects) { 382 bool peer_supports_stateless_rejects) {
378 peer_supports_stateless_rejects_ = peer_supports_stateless_rejects; 383 peer_supports_stateless_rejects_ = peer_supports_stateless_rejects;
379 } 384 }
380 385
381 void QuicCryptoServerStream::SetPreviousCachedNetworkParams( 386 void QuicCryptoServerStream::SetPreviousCachedNetworkParams(
382 CachedNetworkParameters cached_network_params) { 387 CachedNetworkParameters cached_network_params) {
383 previous_cached_network_params_.reset( 388 previous_cached_network_params_.reset(
384 new CachedNetworkParameters(cached_network_params)); 389 new CachedNetworkParameters(cached_network_params));
385 } 390 }
(...skipping 20 matching lines...) Expand all
406 std::unique_ptr<ProofSource::Details> proof_source_details, 411 std::unique_ptr<ProofSource::Details> proof_source_details,
407 std::unique_ptr<ProcessClientHelloResultCallback> done_cb) { 412 std::unique_ptr<ProcessClientHelloResultCallback> done_cb) {
408 const CryptoHandshakeMessage& message = result->client_hello; 413 const CryptoHandshakeMessage& message = result->client_hello;
409 string error_details; 414 string error_details;
410 if (!helper_->CanAcceptClientHello( 415 if (!helper_->CanAcceptClientHello(
411 message, session()->connection()->self_address(), &error_details)) { 416 message, session()->connection()->self_address(), &error_details)) {
412 done_cb->Run(QUIC_HANDSHAKE_FAILED, error_details, nullptr, nullptr, 417 done_cb->Run(QUIC_HANDSHAKE_FAILED, error_details, nullptr, nullptr,
413 nullptr); 418 nullptr);
414 return; 419 return;
415 } 420 }
416
417 if (!result->info.server_nonce.empty()) { 421 if (!result->info.server_nonce.empty()) {
418 ++num_handshake_messages_with_server_nonces_; 422 ++num_handshake_messages_with_server_nonces_;
419 } 423 }
424
425 if (num_handshake_messages_ == 1) {
426 // Client attempts zero RTT handshake by sending a non-inchoate CHLO.
427 QuicStringPiece public_value;
428 zero_rtt_attempted_ = message.GetStringPiece(kPUBS, &public_value);
429 }
430
420 // Store the bandwidth estimate from the client. 431 // Store the bandwidth estimate from the client.
421 if (result->cached_network_params.bandwidth_estimate_bytes_per_second() > 0) { 432 if (result->cached_network_params.bandwidth_estimate_bytes_per_second() > 0) {
422 previous_cached_network_params_.reset( 433 previous_cached_network_params_.reset(
423 new CachedNetworkParameters(result->cached_network_params)); 434 new CachedNetworkParameters(result->cached_network_params));
424 } 435 }
425 previous_source_address_tokens_ = result->info.source_address_tokens; 436 previous_source_address_tokens_ = result->info.source_address_tokens;
426 437
427 const bool use_stateless_rejects_in_crypto_config = 438 const bool use_stateless_rejects_in_crypto_config =
428 use_stateless_rejects_if_peer_supported_ && 439 use_stateless_rejects_if_peer_supported_ &&
429 peer_supports_stateless_rejects_; 440 peer_supports_stateless_rejects_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 } 478 }
468 return helper_->GenerateConnectionIdForReject( 479 return helper_->GenerateConnectionIdForReject(
469 session()->connection()->connection_id()); 480 session()->connection()->connection_id());
470 } 481 }
471 482
472 const QuicSocketAddress QuicCryptoServerStream::GetClientAddress() { 483 const QuicSocketAddress QuicCryptoServerStream::GetClientAddress() {
473 return session()->connection()->peer_address(); 484 return session()->connection()->peer_address();
474 } 485 }
475 486
476 } // namespace net 487 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_crypto_server_stream.h ('k') | net/quic/core/quic_crypto_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698