Chromium Code Reviews| 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 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ | 5 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| 6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_ | 6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 size_t max_packet_length, | 101 size_t max_packet_length, |
| 102 const std::string& user_agent_id, | 102 const std::string& user_agent_id, |
| 103 const QuicVersionVector& supported_versions, | 103 const QuicVersionVector& supported_versions, |
| 104 bool enable_port_selection, | 104 bool enable_port_selection, |
| 105 bool always_require_handshake_confirmation, | 105 bool always_require_handshake_confirmation, |
| 106 bool disable_connection_pooling, | 106 bool disable_connection_pooling, |
| 107 float load_server_info_timeout_srtt_multiplier, | 107 float load_server_info_timeout_srtt_multiplier, |
| 108 bool enable_connection_racing, | 108 bool enable_connection_racing, |
| 109 bool enable_non_blocking_io, | 109 bool enable_non_blocking_io, |
| 110 bool disable_disk_cache, | 110 bool disable_disk_cache, |
| 111 int max_number_of_lossy_connections, | |
| 112 float packet_loss_threshold, | |
| 111 int socket_receive_buffer_size, | 113 int socket_receive_buffer_size, |
| 112 const QuicTagVector& connection_options); | 114 const QuicTagVector& connection_options); |
| 113 ~QuicStreamFactory() override; | 115 ~QuicStreamFactory() override; |
| 114 | 116 |
| 115 // Creates a new QuicHttpStream to |host_port_pair| which will be | 117 // Creates a new QuicHttpStream to |host_port_pair| which will be |
| 116 // owned by |request|. |is_https| specifies if the protocol is https or not. | 118 // owned by |request|. |is_https| specifies if the protocol is https or not. |
| 117 // If a matching session already exists, this method will return OK. If no | 119 // If a matching session already exists, this method will return OK. If no |
| 118 // matching session exists, this will return ERR_IO_PENDING and will invoke | 120 // matching session exists, this will return ERR_IO_PENDING and will invoke |
| 119 // OnRequestComplete asynchronously. | 121 // OnRequestComplete asynchronously. |
| 120 int Create(const HostPortPair& host_port_pair, | 122 int Create(const HostPortPair& host_port_pair, |
| 121 bool is_https, | 123 bool is_https, |
| 122 PrivacyMode privacy_mode, | 124 PrivacyMode privacy_mode, |
| 123 base::StringPiece method, | 125 base::StringPiece method, |
| 124 const BoundNetLog& net_log, | 126 const BoundNetLog& net_log, |
| 125 QuicStreamRequest* request); | 127 QuicStreamRequest* request); |
| 126 | 128 |
| 129 // Keeps track of connections that had bad packet loss when handshake is | |
| 130 // confirmed. Marks QUIC as recently broken for the given |server_id|. If the | |
| 131 // total number of lossy connections is more than | |
| 132 // max_number_of_lossy_connections_ then QUIC is disabled. | |
| 133 void OnBadPacketLoss(const QuicServerId& server_id); | |
| 134 | |
| 127 // Called by a session when it becomes idle. | 135 // Called by a session when it becomes idle. |
| 128 void OnIdleSession(QuicClientSession* session); | 136 void OnIdleSession(QuicClientSession* session); |
| 129 | 137 |
| 130 // Called by a session when it is going away and no more streams should be | 138 // Called by a session when it is going away and no more streams should be |
| 131 // created on it. | 139 // created on it. |
| 132 void OnSessionGoingAway(QuicClientSession* session); | 140 void OnSessionGoingAway(QuicClientSession* session); |
| 133 | 141 |
| 134 // Called by a session after it shuts down. | 142 // Called by a session after it shuts down. |
| 135 void OnSessionClosed(QuicClientSession* session); | 143 void OnSessionClosed(QuicClientSession* session); |
| 136 | 144 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 QuicServerInfoFactory* quic_server_info_factory) { | 186 QuicServerInfoFactory* quic_server_info_factory) { |
| 179 DCHECK(!quic_server_info_factory_); | 187 DCHECK(!quic_server_info_factory_); |
| 180 quic_server_info_factory_ = quic_server_info_factory; | 188 quic_server_info_factory_ = quic_server_info_factory; |
| 181 } | 189 } |
| 182 | 190 |
| 183 bool enable_connection_racing() const { return enable_connection_racing_; } | 191 bool enable_connection_racing() const { return enable_connection_racing_; } |
| 184 void set_enable_connection_racing(bool enable_connection_racing) { | 192 void set_enable_connection_racing(bool enable_connection_racing) { |
| 185 enable_connection_racing_ = enable_connection_racing; | 193 enable_connection_racing_ = enable_connection_racing; |
| 186 } | 194 } |
| 187 | 195 |
| 196 bool quic_is_disabled() const { return quic_is_disabled_; } | |
|
Ryan Hamilton
2015/03/23 02:31:06
I think we need this per-port.
ramant (doing other things)
2015/03/24 03:07:22
Done.
| |
| 197 | |
| 198 float packet_loss_threshold() const { return packet_loss_threshold_; } | |
| 199 | |
| 188 private: | 200 private: |
| 189 class Job; | 201 class Job; |
| 190 friend class test::QuicStreamFactoryPeer; | 202 friend class test::QuicStreamFactoryPeer; |
| 191 | 203 |
| 192 // The key used to find session by ip. Includes | 204 // The key used to find session by ip. Includes |
| 193 // the ip address, port, and scheme. | 205 // the ip address, port, and scheme. |
| 194 struct NET_EXPORT_PRIVATE IpAliasKey { | 206 struct NET_EXPORT_PRIVATE IpAliasKey { |
| 195 IpAliasKey(); | 207 IpAliasKey(); |
| 196 IpAliasKey(IPEndPoint ip_endpoint, bool is_https); | 208 IpAliasKey(IPEndPoint ip_endpoint, bool is_https); |
| 197 ~IpAliasKey(); | 209 ~IpAliasKey(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 // INCHOATE_HELLO and another connection that sends CHLO after loading server | 332 // INCHOATE_HELLO and another connection that sends CHLO after loading server |
| 321 // config from the disk cache. | 333 // config from the disk cache. |
| 322 bool enable_connection_racing_; | 334 bool enable_connection_racing_; |
| 323 | 335 |
| 324 // Set if experimental non-blocking IO should be used on windows sockets. | 336 // Set if experimental non-blocking IO should be used on windows sockets. |
| 325 bool enable_non_blocking_io_; | 337 bool enable_non_blocking_io_; |
| 326 | 338 |
| 327 // Set if we do not want to load server config from the disk cache. | 339 // Set if we do not want to load server config from the disk cache. |
| 328 bool disable_disk_cache_; | 340 bool disable_disk_cache_; |
| 329 | 341 |
| 342 // Set if we want to disable QUIC when there is high packet loss rate. | |
| 343 int max_number_of_lossy_connections_; | |
| 344 int number_of_lossy_connections_; // Count of connections with high packet | |
| 345 // loss. | |
| 346 bool quic_is_disabled_; // Disabled in case of high packet loss. | |
| 347 float packet_loss_threshold_; | |
| 348 | |
| 330 // Size of the UDP receive buffer. | 349 // Size of the UDP receive buffer. |
| 331 int socket_receive_buffer_size_; | 350 int socket_receive_buffer_size_; |
| 332 | 351 |
| 333 // Each profile will (probably) have a unique port_seed_ value. This value | 352 // Each profile will (probably) have a unique port_seed_ value. This value |
| 334 // is used to help seed a pseudo-random number generator (PortSuggester) so | 353 // is used to help seed a pseudo-random number generator (PortSuggester) so |
| 335 // that we consistently (within this profile) suggest the same ephemeral | 354 // that we consistently (within this profile) suggest the same ephemeral |
| 336 // port when we re-connect to any given server/port. The differences between | 355 // port when we re-connect to any given server/port. The differences between |
| 337 // profiles (probablistically) prevent two profiles from colliding in their | 356 // profiles (probablistically) prevent two profiles from colliding in their |
| 338 // ephemeral port requests. | 357 // ephemeral port requests. |
| 339 uint64 port_seed_; | 358 uint64 port_seed_; |
| 340 | 359 |
| 341 // Local address of socket that was created in CreateSession. | 360 // Local address of socket that was created in CreateSession. |
| 342 IPEndPoint local_address_; | 361 IPEndPoint local_address_; |
| 343 bool check_persisted_supports_quic_; | 362 bool check_persisted_supports_quic_; |
| 344 std::set<HostPortPair> quic_supported_servers_at_startup_; | 363 std::set<HostPortPair> quic_supported_servers_at_startup_; |
| 345 | 364 |
| 346 NetworkConnection network_connection_; | 365 NetworkConnection network_connection_; |
| 347 | 366 |
| 348 base::TaskRunner* task_runner_; | 367 base::TaskRunner* task_runner_; |
| 349 | 368 |
| 350 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 369 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
| 351 | 370 |
| 352 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 371 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
| 353 }; | 372 }; |
| 354 | 373 |
| 355 } // namespace net | 374 } // namespace net |
| 356 | 375 |
| 357 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 376 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| OLD | NEW |