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 number_of_lossy_handshakes, |
| 112 int 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 // Called by a session when crypto handshake is either confirmed or timedout. |
| 130 // Returns QUIC_NO_ERROR if there is no high packet loss. If there is a bad |
| 131 // packet loss rate, mark QUIC as recently broken for the given |server_id|, |
| 132 // closes the connection and returns QUIC_BAD_PACKET_LOSS_RATE. |
| 133 QuicErrorCode OnCryptoHandshakeCompleted(QuicClientSession* session, |
| 134 const QuicServerId& server_id, |
| 135 int number_of_handshakes); |
| 136 |
127 // Called by a session when it becomes idle. | 137 // Called by a session when it becomes idle. |
128 void OnIdleSession(QuicClientSession* session); | 138 void OnIdleSession(QuicClientSession* session); |
129 | 139 |
130 // Called by a session when it is going away and no more streams should be | 140 // Called by a session when it is going away and no more streams should be |
131 // created on it. | 141 // created on it. |
132 void OnSessionGoingAway(QuicClientSession* session); | 142 void OnSessionGoingAway(QuicClientSession* session); |
133 | 143 |
134 // Called by a session after it shuts down. | 144 // Called by a session after it shuts down. |
135 void OnSessionClosed(QuicClientSession* session); | 145 void OnSessionClosed(QuicClientSession* session); |
136 | 146 |
(...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 | 330 // INCHOATE_HELLO and another connection that sends CHLO after loading server |
321 // config from the disk cache. | 331 // config from the disk cache. |
322 bool enable_connection_racing_; | 332 bool enable_connection_racing_; |
323 | 333 |
324 // Set if experimental non-blocking IO should be used on windows sockets. | 334 // Set if experimental non-blocking IO should be used on windows sockets. |
325 bool enable_non_blocking_io_; | 335 bool enable_non_blocking_io_; |
326 | 336 |
327 // Set if we do not want to load server config from the disk cache. | 337 // Set if we do not want to load server config from the disk cache. |
328 bool disable_disk_cache_; | 338 bool disable_disk_cache_; |
329 | 339 |
| 340 // Set if we want to disable QUIC for a connection if packet loss rate is bad. |
| 341 int number_of_lossy_handshakes_; |
| 342 int packet_loss_threshold_; |
| 343 |
| 344 // Set if we do not want to use 0-RTT (not use server config from cache). |
| 345 bool disable_zero_rtt_; |
| 346 |
330 // Size of the UDP receive buffer. | 347 // Size of the UDP receive buffer. |
331 int socket_receive_buffer_size_; | 348 int socket_receive_buffer_size_; |
332 | 349 |
333 // Each profile will (probably) have a unique port_seed_ value. This value | 350 // 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 | 351 // is used to help seed a pseudo-random number generator (PortSuggester) so |
335 // that we consistently (within this profile) suggest the same ephemeral | 352 // that we consistently (within this profile) suggest the same ephemeral |
336 // port when we re-connect to any given server/port. The differences between | 353 // port when we re-connect to any given server/port. The differences between |
337 // profiles (probablistically) prevent two profiles from colliding in their | 354 // profiles (probablistically) prevent two profiles from colliding in their |
338 // ephemeral port requests. | 355 // ephemeral port requests. |
339 uint64 port_seed_; | 356 uint64 port_seed_; |
340 | 357 |
341 // Local address of socket that was created in CreateSession. | 358 // Local address of socket that was created in CreateSession. |
342 IPEndPoint local_address_; | 359 IPEndPoint local_address_; |
343 bool check_persisted_supports_quic_; | 360 bool check_persisted_supports_quic_; |
344 std::set<HostPortPair> quic_supported_servers_at_startup_; | 361 std::set<HostPortPair> quic_supported_servers_at_startup_; |
345 | 362 |
346 NetworkConnection network_connection_; | 363 NetworkConnection network_connection_; |
347 | 364 |
348 base::TaskRunner* task_runner_; | 365 base::TaskRunner* task_runner_; |
349 | 366 |
350 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; | 367 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; |
351 | 368 |
352 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); | 369 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
353 }; | 370 }; |
354 | 371 |
355 } // namespace net | 372 } // namespace net |
356 | 373 |
357 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ | 374 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |
OLD | NEW |