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