Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: net/quic/quic_client_session.h

Issue 1208933004: QUIC - disable QUIC under recent pathological connection errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revised after fourth round of review feedback. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/quic/quic_client_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // A client specific QuicSession subclass. This class owns the underlying 5 // A client specific QuicSession subclass. This class owns the underlying
6 // QuicConnection and QuicConnectionHelper objects. The connection stores 6 // QuicConnection and QuicConnectionHelper objects. The connection stores
7 // a non-owning pointer to the helper so this session needs to ensure that 7 // a non-owning pointer to the helper so this session needs to ensure that
8 // the helper outlives the connection. 8 // the helper outlives the connection.
9 9
10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_ 10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_
(...skipping 26 matching lines...) Expand all
37 class SSLInfo; 37 class SSLInfo;
38 class TransportSecurityState; 38 class TransportSecurityState;
39 39
40 namespace test { 40 namespace test {
41 class QuicClientSessionPeer; 41 class QuicClientSessionPeer;
42 } // namespace test 42 } // namespace test
43 43
44 class NET_EXPORT_PRIVATE QuicClientSession : public QuicClientSessionBase, 44 class NET_EXPORT_PRIVATE QuicClientSession : public QuicClientSessionBase,
45 public QuicPacketReader::Visitor { 45 public QuicPacketReader::Visitor {
46 public: 46 public:
47 // Reasons to disable QUIC, that is under certain pathological
48 // connection errors. Note: these values must be kept in sync with
49 // the corresponding values of QuicDisabledReason in:
50 // tools/metrics/histograms/histograms.xml
51 enum QuicDisabledReason {
52 QUIC_DISABLED_NOT = 0, // default, not disabled
53 QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE = 1,
54 QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS = 2,
55 QUIC_DISABLED_BAD_PACKET_LOSS_RATE = 3,
56 QUIC_DISABLED_MAX = 4,
57 };
58
47 // An interface for observing events on a session. 59 // An interface for observing events on a session.
48 class NET_EXPORT_PRIVATE Observer { 60 class NET_EXPORT_PRIVATE Observer {
49 public: 61 public:
50 virtual ~Observer() {} 62 virtual ~Observer() {}
51 virtual void OnCryptoHandshakeConfirmed() = 0; 63 virtual void OnCryptoHandshakeConfirmed() = 0;
52 virtual void OnSessionClosed(int error) = 0; 64 virtual void OnSessionClosed(int error) = 0;
53 }; 65 };
54 66
55 // A helper class used to manage a request to create a stream. 67 // A helper class used to manage a request to create a stream.
56 class NET_EXPORT_PRIVATE StreamRequest { 68 class NET_EXPORT_PRIVATE StreamRequest {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // than the number of round-trips needed for the handshake. 199 // than the number of round-trips needed for the handshake.
188 int GetNumSentClientHellos() const; 200 int GetNumSentClientHellos() const;
189 201
190 // Returns true if |hostname| may be pooled onto this session. If this 202 // Returns true if |hostname| may be pooled onto this session. If this
191 // is a secure QUIC session, then |hostname| must match the certificate 203 // is a secure QUIC session, then |hostname| must match the certificate
192 // presented during the handshake. 204 // presented during the handshake.
193 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; 205 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const;
194 206
195 const QuicServerId& server_id() const { return server_id_; } 207 const QuicServerId& server_id() const { return server_id_; }
196 208
209 QuicDisabledReason disabled_reason() const { return disabled_reason_; }
210
197 protected: 211 protected:
198 // QuicSession methods: 212 // QuicSession methods:
199 QuicDataStream* CreateIncomingDynamicStream(QuicStreamId id) override; 213 QuicDataStream* CreateIncomingDynamicStream(QuicStreamId id) override;
200 214
201 private: 215 private:
202 friend class test::QuicClientSessionPeer; 216 friend class test::QuicClientSessionPeer;
203 217
204 typedef std::set<Observer*> ObserverSet; 218 typedef std::set<Observer*> ObserverSet;
205 typedef std::list<StreamRequest*> StreamRequestQueue; 219 typedef std::list<StreamRequest*> StreamRequestQueue;
206 220
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 size_t num_total_streams_; 268 size_t num_total_streams_;
255 base::TaskRunner* task_runner_; 269 base::TaskRunner* task_runner_;
256 BoundNetLog net_log_; 270 BoundNetLog net_log_;
257 QuicPacketReader packet_reader_; 271 QuicPacketReader packet_reader_;
258 base::TimeTicks dns_resolution_end_time_; 272 base::TimeTicks dns_resolution_end_time_;
259 base::TimeTicks handshake_start_; // Time the handshake was started. 273 base::TimeTicks handshake_start_; // Time the handshake was started.
260 scoped_ptr<QuicConnectionLogger> logger_; 274 scoped_ptr<QuicConnectionLogger> logger_;
261 // True when the session is going away, and streams may no longer be created 275 // True when the session is going away, and streams may no longer be created
262 // on this session. Existing stream will continue to be processed. 276 // on this session. Existing stream will continue to be processed.
263 bool going_away_; 277 bool going_away_;
278 QuicDisabledReason disabled_reason_;
264 base::WeakPtrFactory<QuicClientSession> weak_factory_; 279 base::WeakPtrFactory<QuicClientSession> weak_factory_;
265 280
266 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); 281 DISALLOW_COPY_AND_ASSIGN(QuicClientSession);
267 }; 282 };
268 283
269 } // namespace net 284 } // namespace net
270 285
271 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ 286 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_
OLDNEW
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/quic/quic_client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698