Chromium Code Reviews| 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 // 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_CHROMIUM_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 | 51 |
| 52 namespace test { | 52 namespace test { |
| 53 class QuicChromiumClientSessionPeer; | 53 class QuicChromiumClientSessionPeer; |
| 54 } // namespace test | 54 } // namespace test |
| 55 | 55 |
| 56 class NET_EXPORT_PRIVATE QuicChromiumClientSession | 56 class NET_EXPORT_PRIVATE QuicChromiumClientSession |
| 57 : public QuicClientSessionBase, | 57 : public QuicClientSessionBase, |
| 58 public QuicChromiumPacketReader::Visitor, | 58 public QuicChromiumPacketReader::Visitor, |
| 59 public QuicChromiumPacketWriter::WriteErrorObserver { | 59 public QuicChromiumPacketWriter::WriteErrorObserver { |
| 60 public: | 60 public: |
| 61 // Reasons to disable QUIC, that is under certain pathological | |
| 62 // connection errors. Note: these values must be kept in sync with | |
| 63 // the corresponding values of QuicDisabledReason in: | |
| 64 // tools/metrics/histograms/histograms.xml | |
| 65 enum QuicDisabledReason { | |
|
ianswett
2016/09/08 19:37:02
Are we going to want this enum again in the near f
Ryan Hamilton
2016/09/08 19:42:02
I don't think so. But if we need it, we can add it
| |
| 66 QUIC_DISABLED_NOT = 0, // default, not disabled | |
| 67 QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE = 1, | |
| 68 QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS = 2, | |
| 69 QUIC_DISABLED_BAD_PACKET_LOSS_RATE = 3, | |
| 70 QUIC_DISABLED_MAX = 4, | |
| 71 }; | |
| 72 | |
| 73 // An interface for observing events on a session. | 61 // An interface for observing events on a session. |
| 74 class NET_EXPORT_PRIVATE Observer { | 62 class NET_EXPORT_PRIVATE Observer { |
| 75 public: | 63 public: |
| 76 virtual ~Observer() {} | 64 virtual ~Observer() {} |
| 77 virtual void OnCryptoHandshakeConfirmed() = 0; | 65 virtual void OnCryptoHandshakeConfirmed() = 0; |
| 78 virtual void OnSessionClosed(int error, bool port_migration_detected) = 0; | 66 virtual void OnSessionClosed(int error, bool port_migration_detected) = 0; |
| 79 }; | 67 }; |
| 80 | 68 |
| 81 // A helper class used to manage a request to create a stream. | 69 // A helper class used to manage a request to create a stream. |
| 82 class NET_EXPORT_PRIVATE StreamRequest { | 70 class NET_EXPORT_PRIVATE StreamRequest { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 // than the number of round-trips needed for the handshake. | 230 // than the number of round-trips needed for the handshake. |
| 243 int GetNumSentClientHellos() const; | 231 int GetNumSentClientHellos() const; |
| 244 | 232 |
| 245 // Returns true if |hostname| may be pooled onto this session. If this | 233 // Returns true if |hostname| may be pooled onto this session. If this |
| 246 // is a secure QUIC session, then |hostname| must match the certificate | 234 // is a secure QUIC session, then |hostname| must match the certificate |
| 247 // presented during the handshake. | 235 // presented during the handshake. |
| 248 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; | 236 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; |
| 249 | 237 |
| 250 const QuicServerId& server_id() const { return server_id_; } | 238 const QuicServerId& server_id() const { return server_id_; } |
| 251 | 239 |
| 252 QuicDisabledReason disabled_reason() const { return disabled_reason_; } | |
| 253 | |
| 254 // Migrates session onto new socket, i.e., starts reading from | 240 // Migrates session onto new socket, i.e., starts reading from |
| 255 // |socket| in addition to any previous sockets, and sets |writer| | 241 // |socket| in addition to any previous sockets, and sets |writer| |
| 256 // to be the new default writer. Returns true if socket was | 242 // to be the new default writer. Returns true if socket was |
| 257 // successfully added to the session and the session was | 243 // successfully added to the session and the session was |
| 258 // successfully migrated to using the new socket. If not null, | 244 // successfully migrated to using the new socket. If not null, |
| 259 // |packet| is sent on the new network, else a PING frame is | 245 // |packet| is sent on the new network, else a PING frame is |
| 260 // sent. Returns true on successful migration, or false if number of | 246 // sent. Returns true on successful migration, or false if number of |
| 261 // migrations exceeds kMaxReadersPerQuicSession. Takes ownership of | 247 // migrations exceeds kMaxReadersPerQuicSession. Takes ownership of |
| 262 // |socket|, |reader|, and |writer|. | 248 // |socket|, |reader|, and |writer|. |
| 263 bool MigrateToSocket(std::unique_ptr<DatagramClientSocket> socket, | 249 bool MigrateToSocket(std::unique_ptr<DatagramClientSocket> socket, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 BoundNetLog net_log_; | 337 BoundNetLog net_log_; |
| 352 std::vector<std::unique_ptr<QuicChromiumPacketReader>> packet_readers_; | 338 std::vector<std::unique_ptr<QuicChromiumPacketReader>> packet_readers_; |
| 353 base::TimeTicks dns_resolution_end_time_; | 339 base::TimeTicks dns_resolution_end_time_; |
| 354 base::TimeTicks handshake_start_; // Time the handshake was started. | 340 base::TimeTicks handshake_start_; // Time the handshake was started. |
| 355 std::unique_ptr<QuicConnectionLogger> logger_; | 341 std::unique_ptr<QuicConnectionLogger> logger_; |
| 356 // True when the session is going away, and streams may no longer be created | 342 // True when the session is going away, and streams may no longer be created |
| 357 // on this session. Existing stream will continue to be processed. | 343 // on this session. Existing stream will continue to be processed. |
| 358 bool going_away_; | 344 bool going_away_; |
| 359 // True when the session receives a go away from server due to port migration. | 345 // True when the session receives a go away from server due to port migration. |
| 360 bool port_migration_detected_; | 346 bool port_migration_detected_; |
| 361 QuicDisabledReason disabled_reason_; | |
| 362 TokenBindingSignatureMap token_binding_signatures_; | 347 TokenBindingSignatureMap token_binding_signatures_; |
| 363 // UMA histogram counters for streams pushed to this session. | 348 // UMA histogram counters for streams pushed to this session. |
| 364 int streams_pushed_count_; | 349 int streams_pushed_count_; |
| 365 int streams_pushed_and_claimed_count_; | 350 int streams_pushed_and_claimed_count_; |
| 366 // Return value from packet rewrite packet on new socket. Used | 351 // Return value from packet rewrite packet on new socket. Used |
| 367 // during connection migration on socket write error. | 352 // during connection migration on socket write error. |
| 368 int error_code_from_rewrite_; | 353 int error_code_from_rewrite_; |
| 369 bool use_error_code_from_rewrite_; | 354 bool use_error_code_from_rewrite_; |
| 370 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; | 355 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; |
| 371 | 356 |
| 372 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); | 357 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); |
| 373 }; | 358 }; |
| 374 | 359 |
| 375 } // namespace net | 360 } // namespace net |
| 376 | 361 |
| 377 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 362 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
| OLD | NEW |