| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 address.GetFamily() == ADDRESS_FAMILY_IPV6) { | 179 address.GetFamily() == ADDRESS_FAMILY_IPV6) { |
| 180 connection->set_max_packet_length( | 180 connection->set_max_packet_length( |
| 181 connection->max_packet_length() - kAdditionalOverheadForIPv6); | 181 connection->max_packet_length() - kAdditionalOverheadForIPv6); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 void QuicClientSession::InitializeSession( | 185 void QuicClientSession::InitializeSession( |
| 186 const QuicServerId& server_id, | 186 const QuicServerId& server_id, |
| 187 QuicCryptoClientConfig* crypto_config, | 187 QuicCryptoClientConfig* crypto_config, |
| 188 QuicCryptoClientStreamFactory* crypto_client_stream_factory) { | 188 QuicCryptoClientStreamFactory* crypto_client_stream_factory) { |
| 189 server_host_port_ = server_id.host_port_pair(); | 189 server_id_ = server_id; |
| 190 crypto_stream_.reset( | 190 crypto_stream_.reset( |
| 191 crypto_client_stream_factory ? | 191 crypto_client_stream_factory ? |
| 192 crypto_client_stream_factory->CreateQuicCryptoClientStream( | 192 crypto_client_stream_factory->CreateQuicCryptoClientStream( |
| 193 server_id, this, crypto_config) : | 193 server_id, this, crypto_config) : |
| 194 new QuicCryptoClientStream(server_id, this, | 194 new QuicCryptoClientStream(server_id, this, |
| 195 new ProofVerifyContextChromium(net_log_), | 195 new ProofVerifyContextChromium(net_log_), |
| 196 crypto_config)); | 196 crypto_config)); |
| 197 QuicClientSessionBase::InitializeSession(); | 197 QuicClientSessionBase::InitializeSession(); |
| 198 // TODO(rch): pass in full host port proxy pair | 198 // TODO(rch): pass in full host port proxy pair |
| 199 net_log_.BeginEvent(NetLog::TYPE_QUIC_SESSION, | 199 net_log_.BeginEvent(NetLog::TYPE_QUIC_SESSION, |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 return ERR_QUIC_HANDSHAKE_FAILED; | 524 return ERR_QUIC_HANDSHAKE_FAILED; |
| 525 | 525 |
| 526 callback_ = callback; | 526 callback_ = callback; |
| 527 return ERR_IO_PENDING; | 527 return ERR_IO_PENDING; |
| 528 } | 528 } |
| 529 | 529 |
| 530 int QuicClientSession::GetNumSentClientHellos() const { | 530 int QuicClientSession::GetNumSentClientHellos() const { |
| 531 return crypto_stream_->num_sent_client_hellos(); | 531 return crypto_stream_->num_sent_client_hellos(); |
| 532 } | 532 } |
| 533 | 533 |
| 534 bool QuicClientSession::CanPool(const std::string& hostname) const { | 534 bool QuicClientSession::CanPool(const std::string& hostname, |
| 535 PrivacyMode privacy_mode) const { |
| 535 DCHECK(connection()->connected()); | 536 DCHECK(connection()->connected()); |
| 537 if (privacy_mode != server_id_.privacy_mode()) { |
| 538 // Privacy mode must always match. |
| 539 return false; |
| 540 } |
| 536 SSLInfo ssl_info; | 541 SSLInfo ssl_info; |
| 537 if (!GetSSLInfo(&ssl_info) || !ssl_info.cert.get()) { | 542 if (!GetSSLInfo(&ssl_info) || !ssl_info.cert.get()) { |
| 538 // We can always pool with insecure QUIC sessions. | 543 // We can always pool with insecure QUIC sessions. |
| 539 return true; | 544 return true; |
| 540 } | 545 } |
| 541 | 546 |
| 542 return SpdySession::CanPool(transport_security_state_, ssl_info, | 547 return SpdySession::CanPool(transport_security_state_, ssl_info, |
| 543 server_host_port_.host(), hostname); | 548 server_id_.host(), hostname); |
| 544 } | 549 } |
| 545 | 550 |
| 546 QuicDataStream* QuicClientSession::CreateIncomingDataStream( | 551 QuicDataStream* QuicClientSession::CreateIncomingDataStream( |
| 547 QuicStreamId id) { | 552 QuicStreamId id) { |
| 548 DLOG(ERROR) << "Server push not supported"; | 553 DLOG(ERROR) << "Server push not supported"; |
| 549 return nullptr; | 554 return nullptr; |
| 550 } | 555 } |
| 551 | 556 |
| 552 void QuicClientSession::CloseStream(QuicStreamId stream_id) { | 557 void QuicClientSession::CloseStream(QuicStreamId stream_id) { |
| 553 ReliableQuicStream* stream = GetStream(stream_id); | 558 ReliableQuicStream* stream = GetStream(stream_id); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 return; | 934 return; |
| 930 | 935 |
| 931 // TODO(rch): re-enable this code once beta is cut. | 936 // TODO(rch): re-enable this code once beta is cut. |
| 932 // if (stream_factory_) | 937 // if (stream_factory_) |
| 933 // stream_factory_->OnSessionConnectTimeout(this); | 938 // stream_factory_->OnSessionConnectTimeout(this); |
| 934 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); | 939 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); |
| 935 // DCHECK_EQ(0u, GetNumOpenStreams()); | 940 // DCHECK_EQ(0u, GetNumOpenStreams()); |
| 936 } | 941 } |
| 937 | 942 |
| 938 } // namespace net | 943 } // namespace net |
| OLD | NEW |