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 given |server_id|. Increments |number_of_lossy_connections_| | |
132 // for the server_id's port. | |
133 bool OnBadPacketLoss(QuicClientSession* session, | |
134 const QuicServerId& server_id, | |
Ryan Hamilton
2015/03/24 03:43:00
I think |session| has a server_id() method so perh
ramant (doing other things)
2015/03/24 17:19:24
Done.
| |
135 float packet_loss_rate); | |
136 | |
137 // Returns true if the |number_of_lossy_connections_| for the given port is | |
138 // greater than |max_number_of_lossy_connections_|. | |
Ryan Hamilton
2015/03/24 03:43:00
I think I would simply say
// Returns true if QU
ramant (doing other things)
2015/03/24 17:19:23
Done.
| |
139 bool IsQuicDisabled(uint16 port); | |
140 | |
127 // Called by a session when it becomes idle. | 141 // Called by a session when it becomes idle. |
128 void OnIdleSession(QuicClientSession* session); | 142 void OnIdleSession(QuicClientSession* session); |
129 | 143 |
130 // Called by a session when it is going away and no more streams should be | 144 // Called by a session when it is going away and no more streams should be |
131 // created on it. | 145 // created on it. |
132 void OnSessionGoingAway(QuicClientSession* session); | 146 void OnSessionGoingAway(QuicClientSession* session); |
133 | 147 |
134 // Called by a session after it shuts down. | 148 // Called by a session after it shuts down. |
135 void OnSessionClosed(QuicClientSession* session); | 149 void OnSessionClosed(QuicClientSession* session); |
136 | 150 |
(...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 | 334 // INCHOATE_HELLO and another connection that sends CHLO after loading server |
321 // config from the disk cache. | 335 // config from the disk cache. |
322 bool enable_connection_racing_; | 336 bool enable_connection_racing_; |
323 | 337 |
324 // Set if experimental non-blocking IO should be used on windows sockets. | 338 // Set if experimental non-blocking IO should be used on windows sockets. |
325 bool enable_non_blocking_io_; | 339 bool enable_non_blocking_io_; |
326 | 340 |
327 // Set if we do not want to load server config from the disk cache. | 341 // Set if we do not want to load server config from the disk cache. |
328 bool disable_disk_cache_; | 342 bool disable_disk_cache_; |
329 | 343 |
344 // Set if we want to disable QUIC when there is high packet loss rate. | |
345 int max_number_of_lossy_connections_; | |
346 float packet_loss_threshold_; | |
347 // Count number of lossy connections by port. | |
348 std::map<uint16, int> number_of_lossy_connections_; | |
349 | |
330 // Size of the UDP receive buffer. | 350 // Size of the UDP receive buffer. |
331 int socket_receive_buffer_size_; | 351 int socket_receive_buffer_size_; |
332 | 352 |
333 // Each profile will (probably) have a unique port_seed_ value. This value | 353 // 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 | 354 // is used to help seed a pseudo-random number generator (PortSuggester) so |
335 // that we consistently (within this profile) suggest the same ephemeral | 355 // that we consistently (within this profile) suggest the same ephemeral |
336 // port when we re-connect to any given server/port. The differences between | 356 // port when we re-connect to any given server/port. The differences between |
337 // profiles (probablistically) prevent two profiles from colliding in their | 357 // profiles (probablistically) prevent two profiles from colliding in their |
338 // ephemeral port requests. | 358 // ephemeral port requests. |
339 uint64 port_seed_; | 359 uint64 port_seed_; |
340 | 360 |
341 // Local address of socket that was created in CreateSession. | 361 // Local address of socket that was created in CreateSession. |
342 IPEndPoint local_address_; | 362 IPEndPoint local_address_; |
343 bool check_persisted_supports_quic_; | 363 bool check_persisted_supports_quic_; |
344 std::set<HostPortPair> quic_supported_servers_at_startup_; | 364 std::set<HostPortPair> quic_supported_servers_at_startup_; |
345 | 365 |
346 NetworkConnection network_connection_; | 366 NetworkConnection network_connection_; |
347 | 367 |
348 base::TaskRunner* task_runner_; | 368 base::TaskRunner* task_runner_; |
349 | 369 |
350 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 370 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
351 | 371 |
352 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 372 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
353 }; | 373 }; |
354 | 374 |
355 } // namespace net | 375 } // namespace net |
356 | 376 |
357 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 377 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
OLD | NEW |