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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <list> | 11 #include <list> |
9 #include <map> | 12 #include <map> |
10 #include <string> | 13 #include <string> |
11 #include <vector> | 14 #include <vector> |
12 | 15 |
13 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
14 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
16 #include "base/time/time.h" | 20 #include "base/time/time.h" |
17 #include "net/base/address_list.h" | 21 #include "net/base/address_list.h" |
18 #include "net/base/completion_callback.h" | 22 #include "net/base/completion_callback.h" |
19 #include "net/base/host_port_pair.h" | 23 #include "net/base/host_port_pair.h" |
20 #include "net/base/network_change_notifier.h" | 24 #include "net/base/network_change_notifier.h" |
21 #include "net/cert/cert_database.h" | 25 #include "net/cert/cert_database.h" |
22 #include "net/log/net_log.h" | 26 #include "net/log/net_log.h" |
23 #include "net/proxy/proxy_server.h" | 27 #include "net/proxy/proxy_server.h" |
24 #include "net/quic/network_connection.h" | 28 #include "net/quic/network_connection.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // it marks QUIC as recently broken for the port of the session. Increments | 168 // it marks QUIC as recently broken for the port of the session. Increments |
165 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_| | 169 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_| |
166 // is greater than or equal to |max_number_of_lossy_connections_| then it | 170 // is greater than or equal to |max_number_of_lossy_connections_| then it |
167 // disables QUIC. If QUIC is disabled then it closes the connection. | 171 // disables QUIC. If QUIC is disabled then it closes the connection. |
168 // | 172 // |
169 // Returns true if QUIC is disabled for the port of the session. | 173 // Returns true if QUIC is disabled for the port of the session. |
170 bool OnHandshakeConfirmed(QuicChromiumClientSession* session, | 174 bool OnHandshakeConfirmed(QuicChromiumClientSession* session, |
171 float packet_loss_rate); | 175 float packet_loss_rate); |
172 | 176 |
173 // Returns true if QUIC is disabled for this port. | 177 // Returns true if QUIC is disabled for this port. |
174 bool IsQuicDisabled(uint16 port); | 178 bool IsQuicDisabled(uint16_t port); |
175 | 179 |
176 // Returns reason QUIC is disabled for this port, or QUIC_DISABLED_NOT if not. | 180 // Returns reason QUIC is disabled for this port, or QUIC_DISABLED_NOT if not. |
177 QuicChromiumClientSession::QuicDisabledReason QuicDisabledReason( | 181 QuicChromiumClientSession::QuicDisabledReason QuicDisabledReason( |
178 uint16 port) const; | 182 uint16_t port) const; |
179 | 183 |
180 // Returns reason QUIC is disabled as string for net-internals, or | 184 // Returns reason QUIC is disabled as string for net-internals, or |
181 // returns empty string if QUIC is not disabled. | 185 // returns empty string if QUIC is not disabled. |
182 const char* QuicDisabledReasonString() const; | 186 const char* QuicDisabledReasonString() const; |
183 | 187 |
184 // Called by a session when it becomes idle. | 188 // Called by a session when it becomes idle. |
185 void OnIdleSession(QuicChromiumClientSession* session); | 189 void OnIdleSession(QuicChromiumClientSession* session); |
186 | 190 |
187 // Called by a session when it is going away and no more streams should be | 191 // Called by a session when it is going away and no more streams should be |
188 // created on it. | 192 // created on it. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 const AddressList& address_list, | 302 const AddressList& address_list, |
299 base::TimeTicks dns_resolution_end_time, | 303 base::TimeTicks dns_resolution_end_time, |
300 const BoundNetLog& net_log, | 304 const BoundNetLog& net_log, |
301 QuicChromiumClientSession** session); | 305 QuicChromiumClientSession** session); |
302 void ActivateSession(const QuicServerId& key, | 306 void ActivateSession(const QuicServerId& key, |
303 QuicChromiumClientSession* session); | 307 QuicChromiumClientSession* session); |
304 | 308 |
305 // Returns |srtt| in micro seconds from ServerNetworkStats. Returns 0 if there | 309 // Returns |srtt| in micro seconds from ServerNetworkStats. Returns 0 if there |
306 // is no |http_server_properties_| or if |http_server_properties_| doesn't | 310 // is no |http_server_properties_| or if |http_server_properties_| doesn't |
307 // have ServerNetworkStats for the given |server_id|. | 311 // have ServerNetworkStats for the given |server_id|. |
308 int64 GetServerNetworkStatsSmoothedRttInMicroseconds( | 312 int64_t GetServerNetworkStatsSmoothedRttInMicroseconds( |
309 const QuicServerId& server_id) const; | 313 const QuicServerId& server_id) const; |
310 | 314 |
311 // Helper methods. | 315 // Helper methods. |
312 bool WasQuicRecentlyBroken(const QuicServerId& server_id) const; | 316 bool WasQuicRecentlyBroken(const QuicServerId& server_id) const; |
313 | 317 |
314 bool CryptoConfigCacheIsEmpty(const QuicServerId& server_id); | 318 bool CryptoConfigCacheIsEmpty(const QuicServerId& server_id); |
315 | 319 |
316 // Initializes the cached state associated with |server_id| in | 320 // Initializes the cached state associated with |server_id| in |
317 // |crypto_config_| with the information in |server_info|. | 321 // |crypto_config_| with the information in |server_info|. |
318 void InitializeCachedStateInCryptoConfig( | 322 void InitializeCachedStateInCryptoConfig( |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 bool prefer_aes_; | 410 bool prefer_aes_; |
407 | 411 |
408 // Set if we want to disable QUIC when there is high packet loss rate. | 412 // Set if we want to disable QUIC when there is high packet loss rate. |
409 // Specifies the maximum number of connections with high packet loss in a row | 413 // Specifies the maximum number of connections with high packet loss in a row |
410 // after which QUIC will be disabled. | 414 // after which QUIC will be disabled. |
411 int max_number_of_lossy_connections_; | 415 int max_number_of_lossy_connections_; |
412 // Specifies packet loss rate in fraction after which a connection is closed | 416 // Specifies packet loss rate in fraction after which a connection is closed |
413 // and is considered as a lossy connection. | 417 // and is considered as a lossy connection. |
414 float packet_loss_threshold_; | 418 float packet_loss_threshold_; |
415 // Count number of lossy connections by port. | 419 // Count number of lossy connections by port. |
416 std::map<uint16, int> number_of_lossy_connections_; | 420 std::map<uint16_t, int> number_of_lossy_connections_; |
417 | 421 |
418 // Keep track of stats for recently closed connections, using a | 422 // Keep track of stats for recently closed connections, using a |
419 // bounded queue. | 423 // bounded queue. |
420 int max_disabled_reasons_; | 424 int max_disabled_reasons_; |
421 DisabledReasonsQueue disabled_reasons_; | 425 DisabledReasonsQueue disabled_reasons_; |
422 // Events that can trigger disabling QUIC | 426 // Events that can trigger disabling QUIC |
423 int num_public_resets_post_handshake_; | 427 int num_public_resets_post_handshake_; |
424 int num_timeouts_with_open_streams_; | 428 int num_timeouts_with_open_streams_; |
425 // Keep track the largest values for UMA histograms, that will help | 429 // Keep track the largest values for UMA histograms, that will help |
426 // determine good threshold values. | 430 // determine good threshold values. |
(...skipping 20 matching lines...) Expand all Loading... |
447 | 451 |
448 // Set if all sessions should be closed when any local IP address changes. | 452 // Set if all sessions should be closed when any local IP address changes. |
449 const bool close_sessions_on_ip_change_; | 453 const bool close_sessions_on_ip_change_; |
450 | 454 |
451 // Each profile will (probably) have a unique port_seed_ value. This value | 455 // Each profile will (probably) have a unique port_seed_ value. This value |
452 // is used to help seed a pseudo-random number generator (PortSuggester) so | 456 // is used to help seed a pseudo-random number generator (PortSuggester) so |
453 // that we consistently (within this profile) suggest the same ephemeral | 457 // that we consistently (within this profile) suggest the same ephemeral |
454 // port when we re-connect to any given server/port. The differences between | 458 // port when we re-connect to any given server/port. The differences between |
455 // profiles (probablistically) prevent two profiles from colliding in their | 459 // profiles (probablistically) prevent two profiles from colliding in their |
456 // ephemeral port requests. | 460 // ephemeral port requests. |
457 uint64 port_seed_; | 461 uint64_t port_seed_; |
458 | 462 |
459 // Local address of socket that was created in CreateSession. | 463 // Local address of socket that was created in CreateSession. |
460 IPEndPoint local_address_; | 464 IPEndPoint local_address_; |
461 bool check_persisted_supports_quic_; | 465 bool check_persisted_supports_quic_; |
462 bool has_initialized_data_; | 466 bool has_initialized_data_; |
463 std::set<HostPortPair> quic_supported_servers_at_startup_; | 467 std::set<HostPortPair> quic_supported_servers_at_startup_; |
464 | 468 |
465 NetworkConnection network_connection_; | 469 NetworkConnection network_connection_; |
466 | 470 |
467 base::TaskRunner* task_runner_; | 471 base::TaskRunner* task_runner_; |
468 | 472 |
469 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 473 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
470 | 474 |
471 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 475 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
472 }; | 476 }; |
473 | 477 |
474 } // namespace net | 478 } // namespace net |
475 | 479 |
476 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 480 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
OLD | NEW |