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 QuicSession, which demuxes a single connection to individual streams. | 5 // A QuicSession, which demuxes a single connection to individual streams. |
6 | 6 |
7 #ifndef NET_QUIC_CORE_QUIC_SESSION_H_ | 7 #ifndef NET_QUIC_CORE_QUIC_SESSION_H_ |
8 #define NET_QUIC_CORE_QUIC_SESSION_H_ | 8 #define NET_QUIC_CORE_QUIC_SESSION_H_ |
9 | 9 |
10 #include <cstddef> | 10 #include <cstddef> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // Called when the connection is closed after the streams have been closed. | 49 // Called when the connection is closed after the streams have been closed. |
50 virtual void OnConnectionClosed(QuicConnectionId connection_id, | 50 virtual void OnConnectionClosed(QuicConnectionId connection_id, |
51 QuicErrorCode error, | 51 QuicErrorCode error, |
52 const std::string& error_details) = 0; | 52 const std::string& error_details) = 0; |
53 | 53 |
54 // Called when the session has become write blocked. | 54 // Called when the session has become write blocked. |
55 virtual void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) = 0; | 55 virtual void OnWriteBlocked(QuicBlockedWriterInterface* blocked_writer) = 0; |
56 | 56 |
57 // Called when the session receives reset on a stream from the peer. | 57 // Called when the session receives reset on a stream from the peer. |
58 virtual void OnRstStreamReceived(const QuicRstStreamFrame& frame) = 0; | 58 virtual void OnRstStreamReceived(const QuicRstStreamFrame& frame) = 0; |
| 59 |
| 60 virtual void OnPushPromiseSent() = 0; |
59 }; | 61 }; |
60 | 62 |
61 // CryptoHandshakeEvent enumerates the events generated by a QuicCryptoStream. | 63 // CryptoHandshakeEvent enumerates the events generated by a QuicCryptoStream. |
62 enum CryptoHandshakeEvent { | 64 enum CryptoHandshakeEvent { |
63 // ENCRYPTION_FIRST_ESTABLISHED indicates that a full client hello has been | 65 // ENCRYPTION_FIRST_ESTABLISHED indicates that a full client hello has been |
64 // sent by a client and that subsequent packets will be encrypted. (Client | 66 // sent by a client and that subsequent packets will be encrypted. (Client |
65 // only.) | 67 // only.) |
66 ENCRYPTION_FIRST_ESTABLISHED, | 68 ENCRYPTION_FIRST_ESTABLISHED, |
67 // ENCRYPTION_REESTABLISHED indicates that a client hello was rejected by | 69 // ENCRYPTION_REESTABLISHED indicates that a client hello was rejected by |
68 // the server and thus the encryption key has been updated. Therefore the | 70 // the server and thus the encryption key has been updated. Therefore the |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 bool MaybeIncreaseLargestPeerStreamId(const QuicStreamId stream_id); | 352 bool MaybeIncreaseLargestPeerStreamId(const QuicStreamId stream_id); |
351 | 353 |
352 void InsertLocallyClosedStreamsHighestOffset(const QuicStreamId id, | 354 void InsertLocallyClosedStreamsHighestOffset(const QuicStreamId id, |
353 QuicStreamOffset offset); | 355 QuicStreamOffset offset); |
354 // If stream is a locally closed stream, this RST will update FIN offset. | 356 // If stream is a locally closed stream, this RST will update FIN offset. |
355 // Otherwise stream is a preserved stream and the behavior of it depends on | 357 // Otherwise stream is a preserved stream and the behavior of it depends on |
356 // derived class's own implementation. | 358 // derived class's own implementation. |
357 virtual void HandleRstOnValidNonexistentStream( | 359 virtual void HandleRstOnValidNonexistentStream( |
358 const QuicRstStreamFrame& frame); | 360 const QuicRstStreamFrame& frame); |
359 | 361 |
| 362 // May be null. |
| 363 Visitor* visitor_; |
| 364 |
360 private: | 365 private: |
361 friend class test::QuicSessionPeer; | 366 friend class test::QuicSessionPeer; |
362 | 367 |
363 // Called in OnConfigNegotiated when we receive a new stream level flow | 368 // Called in OnConfigNegotiated when we receive a new stream level flow |
364 // control window in a negotiated config. Closes the connection if invalid. | 369 // control window in a negotiated config. Closes the connection if invalid. |
365 void OnNewStreamFlowControlWindow(QuicStreamOffset new_window); | 370 void OnNewStreamFlowControlWindow(QuicStreamOffset new_window); |
366 | 371 |
367 // Called in OnConfigNegotiated when we receive a new connection level flow | 372 // Called in OnConfigNegotiated when we receive a new connection level flow |
368 // control window in a negotiated config. Closes the connection if invalid. | 373 // control window in a negotiated config. Closes the connection if invalid. |
369 void OnNewSessionFlowControlWindow(QuicStreamOffset new_window); | 374 void OnNewSessionFlowControlWindow(QuicStreamOffset new_window); |
370 | 375 |
371 // Debug helper for |OnCanWrite()|, check that OnStreamWrite() makes | 376 // Debug helper for |OnCanWrite()|, check that OnStreamWrite() makes |
372 // forward progress. Returns false if busy loop detected. | 377 // forward progress. Returns false if busy loop detected. |
373 bool CheckStreamNotBusyLooping(QuicStream* stream, | 378 bool CheckStreamNotBusyLooping(QuicStream* stream, |
374 uint64_t previous_bytes_written, | 379 uint64_t previous_bytes_written, |
375 bool previous_fin_sent); | 380 bool previous_fin_sent); |
376 | 381 |
377 // Called in OnConfigNegotiated for Finch trials to measure performance of | 382 // Called in OnConfigNegotiated for Finch trials to measure performance of |
378 // starting with larger flow control receive windows. | 383 // starting with larger flow control receive windows. |
379 void AdjustInitialFlowControlWindows(size_t stream_window); | 384 void AdjustInitialFlowControlWindows(size_t stream_window); |
380 | 385 |
381 // Keep track of highest received byte offset of locally closed streams, while | 386 // Keep track of highest received byte offset of locally closed streams, while |
382 // waiting for a definitive final highest offset from the peer. | 387 // waiting for a definitive final highest offset from the peer. |
383 std::map<QuicStreamId, QuicStreamOffset> | 388 std::map<QuicStreamId, QuicStreamOffset> |
384 locally_closed_streams_highest_offset_; | 389 locally_closed_streams_highest_offset_; |
385 | 390 |
386 QuicConnection* connection_; | 391 QuicConnection* connection_; |
387 | 392 |
388 // May be null. | |
389 Visitor* visitor_; | |
390 | |
391 ClosedStreams closed_streams_; | 393 ClosedStreams closed_streams_; |
392 | 394 |
393 QuicConfig config_; | 395 QuicConfig config_; |
394 | 396 |
395 // The maximum number of outgoing streams this connection can open. | 397 // The maximum number of outgoing streams this connection can open. |
396 size_t max_open_outgoing_streams_; | 398 size_t max_open_outgoing_streams_; |
397 | 399 |
398 // The maximum number of incoming streams this connection will allow. | 400 // The maximum number of incoming streams this connection will allow. |
399 size_t max_open_incoming_streams_; | 401 size_t max_open_incoming_streams_; |
400 | 402 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 446 |
445 // Latched value of gfe2_reloadable_flag_quic_flow_control_invariant. | 447 // Latched value of gfe2_reloadable_flag_quic_flow_control_invariant. |
446 const bool flow_control_invariant_; | 448 const bool flow_control_invariant_; |
447 | 449 |
448 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 450 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
449 }; | 451 }; |
450 | 452 |
451 } // namespace net | 453 } // namespace net |
452 | 454 |
453 #endif // NET_QUIC_CORE_QUIC_SESSION_H_ | 455 #endif // NET_QUIC_CORE_QUIC_SESSION_H_ |
OLD | NEW |