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_client_session.h" | 5 #include "net/quic/quic_client_session.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 ssl_info->pinning_failure_log = pinning_failure_log_; | 485 ssl_info->pinning_failure_log = pinning_failure_log_; |
486 return true; | 486 return true; |
487 } | 487 } |
488 | 488 |
489 int QuicClientSession::CryptoConnect(bool require_confirmation, | 489 int QuicClientSession::CryptoConnect(bool require_confirmation, |
490 const CompletionCallback& callback) { | 490 const CompletionCallback& callback) { |
491 require_confirmation_ = require_confirmation; | 491 require_confirmation_ = require_confirmation; |
492 handshake_start_ = base::TimeTicks::Now(); | 492 handshake_start_ = base::TimeTicks::Now(); |
493 RecordHandshakeState(STATE_STARTED); | 493 RecordHandshakeState(STATE_STARTED); |
494 DCHECK(flow_controller()); | 494 DCHECK(flow_controller()); |
495 if (!crypto_stream_->CryptoConnect()) { | 495 crypto_stream_->CryptoConnect(); |
496 // TODO(wtc): change crypto_stream_.CryptoConnect() to return a | |
497 // QuicErrorCode and map it to a net error code. | |
498 return ERR_CONNECTION_FAILED; | |
499 } | |
500 | 496 |
501 if (IsCryptoHandshakeConfirmed()) | 497 if (IsCryptoHandshakeConfirmed()) |
502 return OK; | 498 return OK; |
503 | 499 |
504 // Unless we require handshake confirmation, activate the session if | 500 // Unless we require handshake confirmation, activate the session if |
505 // we have established initial encryption. | 501 // we have established initial encryption. |
506 if (!require_confirmation_ && IsEncryptionEstablished()) { | 502 if (!require_confirmation_ && IsEncryptionEstablished()) { |
507 // To mitigate the effects of hanging 0-RTT connections, set up a timer to | 503 // To mitigate the effects of hanging 0-RTT connections, set up a timer to |
508 // cancel any requests, if the handshake takes too long. | 504 // cancel any requests, if the handshake takes too long. |
509 task_runner_->PostDelayedTask( | 505 task_runner_->PostDelayedTask( |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 return; | 929 return; |
934 | 930 |
935 // TODO(rch): re-enable this code once beta is cut. | 931 // TODO(rch): re-enable this code once beta is cut. |
936 // if (stream_factory_) | 932 // if (stream_factory_) |
937 // stream_factory_->OnSessionConnectTimeout(this); | 933 // stream_factory_->OnSessionConnectTimeout(this); |
938 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); | 934 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); |
939 // DCHECK_EQ(0u, GetNumOpenStreams()); | 935 // DCHECK_EQ(0u, GetNumOpenStreams()); |
940 } | 936 } |
941 | 937 |
942 } // namespace net | 938 } // namespace net |
OLD | NEW |