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

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

Issue 174533002: QUIC - clarified comments for persisting crypto config per comments in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_client_stream.h" 5 #include "net/quic/quic_crypto_client_stream.h"
6 6
7 #include "net/base/completion_callback.h" 7 #include "net/base/completion_callback.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.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"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 if (!quic_server_info) { 420 if (!quic_server_info) {
421 return OK; 421 return OK;
422 } 422 }
423 423
424 generation_counter_ = cached->generation_counter(); 424 generation_counter_ = cached->generation_counter();
425 next_state_ = STATE_LOAD_QUIC_SERVER_INFO_COMPLETE; 425 next_state_ = STATE_LOAD_QUIC_SERVER_INFO_COMPLETE;
426 426
427 // TODO(rtenneti): If multiple tabs load the same URL, all requests except for 427 // TODO(rtenneti): If multiple tabs load the same URL, all requests except for
428 // the first request send InchoateClientHello. Fix the code to handle multiple 428 // the first request send InchoateClientHello. Fix the code to handle multiple
429 // requests. A possible solution is to wait for the first request to finish 429 // requests. A possible solution is to wait for the first request to finish
430 // and use the data from the disk cache for all requests. 430 // and use the data from the disk cache for all requests. We may need to call
wtc 2014/02/21 00:04:28 Please start a new paragraph, to make it clear tha
ramant (doing other things) 2014/02/21 00:08:10 Thanks very much. Done.
431 // quic_server_info->Persist requires quic_server_info to be ready. We might 431 // quic_server_info->Persist later. quic_server_info->Persist requires
432 // have already initialized |cached| config from a the cached state for a 432 // quic_server_info to be ready, so we always call WaitForDataReady, even
433 // canonical hostname. 433 // though we might have initialized |cached| config from the cached state for
434 // a canonical hostname.
434 int rv = quic_server_info->WaitForDataReady( 435 int rv = quic_server_info->WaitForDataReady(
435 base::Bind(&QuicCryptoClientStream::OnIOComplete, 436 base::Bind(&QuicCryptoClientStream::OnIOComplete,
436 base::Unretained(this))); 437 base::Unretained(this)));
437 438
438 if (rv != ERR_IO_PENDING) { 439 if (rv != ERR_IO_PENDING) {
439 disk_cache_load_result_ = rv; 440 disk_cache_load_result_ = rv;
440 } 441 }
441 return rv; 442 return rv;
442 } 443 }
443 444
444 void QuicCryptoClientStream::DoLoadQuicServerInfoComplete( 445 void QuicCryptoClientStream::DoLoadQuicServerInfoComplete(
445 QuicCryptoClientConfig::CachedState* cached) { 446 QuicCryptoClientConfig::CachedState* cached) {
446 next_state_ = STATE_SEND_CHLO; 447 next_state_ = STATE_SEND_CHLO;
447 448
448 // If someone else already saved a server config, we don't want to overwrite 449 // If someone else already saved a server config, we don't want to overwrite
449 // it. Also, if someone else saved a server config and then cleared it (so 450 // it. Also, if someone else saved a server config and then cleared it (so
450 // cached->IsEmpty() is true, but the generation counter changed), we still 451 // cached->IsEmpty() is true), we still want to load from QuicServerInfo.
451 // want to load from QuicServerInfo.
452 if (!cached->IsEmpty()) { 452 if (!cached->IsEmpty()) {
453 // Someone else has already saved a server config received from the network
454 // or the canonical server config.
455 return; 453 return;
456 } 454 }
457 455
458 if (disk_cache_load_result_ != OK || !cached->LoadQuicServerInfo( 456 if (disk_cache_load_result_ != OK || !cached->LoadQuicServerInfo(
459 session()->connection()->clock()->WallNow())) { 457 session()->connection()->clock()->WallNow())) {
460 // It is ok to proceed to STATE_SEND_CHLO when we cannot load QuicServerInfo 458 // It is ok to proceed to STATE_SEND_CHLO when we cannot load QuicServerInfo
461 // from the disk cache. 459 // from the disk cache.
462 DCHECK(cached->IsEmpty()); 460 DCHECK(cached->IsEmpty());
463 DVLOG(1) << "Empty server_config"; 461 DVLOG(1) << "Empty server_config";
464 return; 462 return;
465 } 463 }
466 464
467 ProofVerifier* verifier = crypto_config_->proof_verifier(); 465 ProofVerifier* verifier = crypto_config_->proof_verifier();
468 if (!verifier) { 466 if (!verifier) {
469 // If no verifier is set then we don't check the certificates. 467 // If no verifier is set then we don't check the certificates.
470 cached->SetProofValid(); 468 cached->SetProofValid();
471 } else if (!cached->signature().empty()) { 469 } else if (!cached->signature().empty()) {
472 next_state_ = STATE_VERIFY_PROOF; 470 next_state_ = STATE_VERIFY_PROOF;
473 } 471 }
474 } 472 }
475 473
476 } // namespace net 474 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698