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_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 bool IsEcdsaSupported() { | 79 bool IsEcdsaSupported() { |
80 #if defined(OS_WIN) | 80 #if defined(OS_WIN) |
81 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 81 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
82 return false; | 82 return false; |
83 #endif | 83 #endif |
84 | 84 |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
88 QuicConfig InitializeQuicConfig(bool enable_time_based_loss_detection, | 88 QuicConfig InitializeQuicConfig(const QuicTagVector& connection_options) { |
89 const QuicTagVector& connection_options) { | |
90 QuicConfig config; | 89 QuicConfig config; |
91 config.SetDefaults(); | 90 config.SetDefaults(); |
92 if (enable_time_based_loss_detection) | |
93 config.SetLossDetectionToSend(kTIME); | |
94 config.set_idle_connection_state_lifetime( | 91 config.set_idle_connection_state_lifetime( |
95 QuicTime::Delta::FromSeconds(kIdleConnectionTimeoutSeconds), | 92 QuicTime::Delta::FromSeconds(kIdleConnectionTimeoutSeconds), |
96 QuicTime::Delta::FromSeconds(kIdleConnectionTimeoutSeconds)); | 93 QuicTime::Delta::FromSeconds(kIdleConnectionTimeoutSeconds)); |
97 config.SetConnectionOptionsToSend(connection_options); | 94 config.SetConnectionOptionsToSend(connection_options); |
98 return config; | 95 return config; |
99 } | 96 } |
100 | 97 |
101 class DefaultPacketWriterFactory : public QuicConnection::PacketWriterFactory { | 98 class DefaultPacketWriterFactory : public QuicConnection::PacketWriterFactory { |
102 public: | 99 public: |
103 explicit DefaultPacketWriterFactory(DatagramClientSocket* socket) | 100 explicit DefaultPacketWriterFactory(DatagramClientSocket* socket) |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 CertVerifier* cert_verifier, | 478 CertVerifier* cert_verifier, |
482 ChannelIDService* channel_id_service, | 479 ChannelIDService* channel_id_service, |
483 TransportSecurityState* transport_security_state, | 480 TransportSecurityState* transport_security_state, |
484 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, | 481 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
485 QuicRandom* random_generator, | 482 QuicRandom* random_generator, |
486 QuicClock* clock, | 483 QuicClock* clock, |
487 size_t max_packet_length, | 484 size_t max_packet_length, |
488 const std::string& user_agent_id, | 485 const std::string& user_agent_id, |
489 const QuicVersionVector& supported_versions, | 486 const QuicVersionVector& supported_versions, |
490 bool enable_port_selection, | 487 bool enable_port_selection, |
491 bool enable_time_based_loss_detection, | |
492 bool always_require_handshake_confirmation, | 488 bool always_require_handshake_confirmation, |
493 bool disable_connection_pooling, | 489 bool disable_connection_pooling, |
494 const QuicTagVector& connection_options) | 490 const QuicTagVector& connection_options) |
495 : require_confirmation_(true), | 491 : require_confirmation_(true), |
496 host_resolver_(host_resolver), | 492 host_resolver_(host_resolver), |
497 client_socket_factory_(client_socket_factory), | 493 client_socket_factory_(client_socket_factory), |
498 http_server_properties_(http_server_properties), | 494 http_server_properties_(http_server_properties), |
499 transport_security_state_(transport_security_state), | 495 transport_security_state_(transport_security_state), |
500 quic_server_info_factory_(NULL), | 496 quic_server_info_factory_(NULL), |
501 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 497 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
502 random_generator_(random_generator), | 498 random_generator_(random_generator), |
503 clock_(clock), | 499 clock_(clock), |
504 max_packet_length_(max_packet_length), | 500 max_packet_length_(max_packet_length), |
505 config_(InitializeQuicConfig(enable_time_based_loss_detection, | 501 config_(InitializeQuicConfig(connection_options)), |
506 connection_options)), | |
507 supported_versions_(supported_versions), | 502 supported_versions_(supported_versions), |
508 enable_port_selection_(enable_port_selection), | 503 enable_port_selection_(enable_port_selection), |
509 always_require_handshake_confirmation_( | 504 always_require_handshake_confirmation_( |
510 always_require_handshake_confirmation), | 505 always_require_handshake_confirmation), |
511 disable_connection_pooling_(disable_connection_pooling), | 506 disable_connection_pooling_(disable_connection_pooling), |
512 port_seed_(random_generator_->RandUint64()), | 507 port_seed_(random_generator_->RandUint64()), |
513 weak_factory_(this) { | 508 weak_factory_(this) { |
514 DCHECK(transport_security_state_); | 509 DCHECK(transport_security_state_); |
515 crypto_config_.SetDefaults(); | 510 crypto_config_.SetDefaults(); |
516 crypto_config_.set_user_agent_id(user_agent_id); | 511 crypto_config_.set_user_agent_id(user_agent_id); |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 http_server_properties_->ClearAlternateProtocol(server); | 998 http_server_properties_->ClearAlternateProtocol(server); |
1004 http_server_properties_->SetAlternateProtocol( | 999 http_server_properties_->SetAlternateProtocol( |
1005 server, alternate.port, alternate.protocol, 1); | 1000 server, alternate.port, alternate.protocol, 1); |
1006 DCHECK_EQ(QUIC, | 1001 DCHECK_EQ(QUIC, |
1007 http_server_properties_->GetAlternateProtocol(server).protocol); | 1002 http_server_properties_->GetAlternateProtocol(server).protocol); |
1008 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1003 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
1009 server)); | 1004 server)); |
1010 } | 1005 } |
1011 | 1006 |
1012 } // namespace net | 1007 } // namespace net |
OLD | NEW |