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 // Returns false if |packet_loss_rate| is less than |packet_loss_threshold_| |
| 130 // otherwise it returns true and closes the session and marks QUIC as recently |
| 131 // broken for the port of the session. Increments |
| 132 // |number_of_lossy_connections_| by port. |
| 133 bool OnHandshakeConfirmed(QuicClientSession* session, float packet_loss_rate); |
| 134 |
| 135 // Returns true if QUIC is disabled for this port. |
| 136 bool IsQuicDisabled(uint16 port); |
| 137 |
127 // Called by a session when it becomes idle. | 138 // Called by a session when it becomes idle. |
128 void OnIdleSession(QuicClientSession* session); | 139 void OnIdleSession(QuicClientSession* session); |
129 | 140 |
130 // Called by a session when it is going away and no more streams should be | 141 // Called by a session when it is going away and no more streams should be |
131 // created on it. | 142 // created on it. |
132 void OnSessionGoingAway(QuicClientSession* session); | 143 void OnSessionGoingAway(QuicClientSession* session); |
133 | 144 |
134 // Called by a session after it shuts down. | 145 // Called by a session after it shuts down. |
135 void OnSessionClosed(QuicClientSession* session); | 146 void OnSessionClosed(QuicClientSession* session); |
136 | 147 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // INCHOATE_HELLO and another connection that sends CHLO after loading server | 331 // INCHOATE_HELLO and another connection that sends CHLO after loading server |
321 // config from the disk cache. | 332 // config from the disk cache. |
322 bool enable_connection_racing_; | 333 bool enable_connection_racing_; |
323 | 334 |
324 // Set if experimental non-blocking IO should be used on windows sockets. | 335 // Set if experimental non-blocking IO should be used on windows sockets. |
325 bool enable_non_blocking_io_; | 336 bool enable_non_blocking_io_; |
326 | 337 |
327 // Set if we do not want to load server config from the disk cache. | 338 // Set if we do not want to load server config from the disk cache. |
328 bool disable_disk_cache_; | 339 bool disable_disk_cache_; |
329 | 340 |
| 341 // Set if we want to disable QUIC when there is high packet loss rate. |
| 342 // Specifies the maximum number of connections with high packet loss in a row |
| 343 // after which QUIC will be disabled. |
| 344 int max_number_of_lossy_connections_; |
| 345 // Specifies packet loss rate in franction after which a connection is closed |
| 346 // and is considered as a lossy connection. |
| 347 float packet_loss_threshold_; |
| 348 // Count number of lossy connections by port. |
| 349 std::map<uint16, int> number_of_lossy_connections_; |
| 350 |
330 // Size of the UDP receive buffer. | 351 // Size of the UDP receive buffer. |
331 int socket_receive_buffer_size_; | 352 int socket_receive_buffer_size_; |
332 | 353 |
333 // Each profile will (probably) have a unique port_seed_ value. This value | 354 // 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 | 355 // is used to help seed a pseudo-random number generator (PortSuggester) so |
335 // that we consistently (within this profile) suggest the same ephemeral | 356 // that we consistently (within this profile) suggest the same ephemeral |
336 // port when we re-connect to any given server/port. The differences between | 357 // port when we re-connect to any given server/port. The differences between |
337 // profiles (probablistically) prevent two profiles from colliding in their | 358 // profiles (probablistically) prevent two profiles from colliding in their |
338 // ephemeral port requests. | 359 // ephemeral port requests. |
339 uint64 port_seed_; | 360 uint64 port_seed_; |
340 | 361 |
341 // Local address of socket that was created in CreateSession. | 362 // Local address of socket that was created in CreateSession. |
342 IPEndPoint local_address_; | 363 IPEndPoint local_address_; |
343 bool check_persisted_supports_quic_; | 364 bool check_persisted_supports_quic_; |
344 std::set<HostPortPair> quic_supported_servers_at_startup_; | 365 std::set<HostPortPair> quic_supported_servers_at_startup_; |
345 | 366 |
346 NetworkConnection network_connection_; | 367 NetworkConnection network_connection_; |
347 | 368 |
348 base::TaskRunner* task_runner_; | 369 base::TaskRunner* task_runner_; |
349 | 370 |
350 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 371 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
351 | 372 |
352 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 373 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
353 }; | 374 }; |
354 | 375 |
355 } // namespace net | 376 } // namespace net |
356 | 377 |
357 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 378 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
OLD | NEW |