| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void OnConnectionMigration(PeerAddressChangeType type) override {} | 101 void OnConnectionMigration(PeerAddressChangeType type) override {} |
| 102 // Deletes streams that are safe to be deleted now that it's safe to do so (no | 102 // Deletes streams that are safe to be deleted now that it's safe to do so (no |
| 103 // other operations are being done on the streams at this time). | 103 // other operations are being done on the streams at this time). |
| 104 void PostProcessAfterData() override; | 104 void PostProcessAfterData() override; |
| 105 // Adds a connection level WINDOW_UPDATE frame. | 105 // Adds a connection level WINDOW_UPDATE frame. |
| 106 void OnAckNeedsRetransmittableFrame() override; | 106 void OnAckNeedsRetransmittableFrame() override; |
| 107 bool WillingAndAbleToWrite() const override; | 107 bool WillingAndAbleToWrite() const override; |
| 108 bool HasPendingHandshake() const override; | 108 bool HasPendingHandshake() const override; |
| 109 bool HasOpenDynamicStreams() const override; | 109 bool HasOpenDynamicStreams() const override; |
| 110 void OnPathDegrading() override; | 110 void OnPathDegrading() override; |
| 111 void SaveStreamData(QuicStreamId id, |
| 112 QuicIOVector iov, |
| 113 size_t iov_offset, |
| 114 QuicStreamOffset offset, |
| 115 QuicByteCount data_length) override; |
| 116 bool WriteStreamData(QuicStreamId id, |
| 117 QuicStreamOffset offset, |
| 118 QuicByteCount data_length, |
| 119 QuicDataWriter* writer) override; |
| 111 | 120 |
| 112 // StreamNotifierInterface methods: | 121 // StreamNotifierInterface methods: |
| 113 void OnStreamFrameAcked(const QuicStreamFrame& frame, | 122 void OnStreamFrameAcked(const QuicStreamFrame& frame, |
| 114 QuicTime::Delta ack_delay_time) override; | 123 QuicTime::Delta ack_delay_time) override; |
| 115 void OnStreamFrameRetransmitted(const QuicStreamFrame& frame) override; | 124 void OnStreamFrameRetransmitted(const QuicStreamFrame& frame) override; |
| 116 void OnStreamFrameDiscarded(const QuicStreamFrame& frame) override; | 125 void OnStreamFrameDiscarded(const QuicStreamFrame& frame) override; |
| 117 | 126 |
| 118 // Called on every incoming packet. Passes |packet| through to |connection_|. | 127 // Called on every incoming packet. Passes |packet| through to |connection_|. |
| 119 virtual void ProcessUdpPacket(const QuicSocketAddress& self_address, | 128 virtual void ProcessUdpPacket(const QuicSocketAddress& self_address, |
| 120 const QuicSocketAddress& peer_address, | 129 const QuicSocketAddress& peer_address, |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 | 271 |
| 263 // Returns true if this stream should yield writes to another blocked stream. | 272 // Returns true if this stream should yield writes to another blocked stream. |
| 264 bool ShouldYield(QuicStreamId stream_id); | 273 bool ShouldYield(QuicStreamId stream_id); |
| 265 | 274 |
| 266 void set_respect_goaway(bool respect_goaway) { | 275 void set_respect_goaway(bool respect_goaway) { |
| 267 respect_goaway_ = respect_goaway; | 276 respect_goaway_ = respect_goaway; |
| 268 } | 277 } |
| 269 | 278 |
| 270 bool use_stream_notifier() const { return use_stream_notifier_; } | 279 bool use_stream_notifier() const { return use_stream_notifier_; } |
| 271 | 280 |
| 281 bool streams_own_data() const { return streams_own_data_; } |
| 282 |
| 272 protected: | 283 protected: |
| 273 using StaticStreamMap = QuicSmallMap<QuicStreamId, QuicStream*, 2>; | 284 using StaticStreamMap = QuicSmallMap<QuicStreamId, QuicStream*, 2>; |
| 274 | 285 |
| 275 using DynamicStreamMap = | 286 using DynamicStreamMap = |
| 276 QuicSmallMap<QuicStreamId, std::unique_ptr<QuicStream>, 10>; | 287 QuicSmallMap<QuicStreamId, std::unique_ptr<QuicStream>, 10>; |
| 277 | 288 |
| 278 using ClosedStreams = std::vector<std::unique_ptr<QuicStream>>; | 289 using ClosedStreams = std::vector<std::unique_ptr<QuicStream>>; |
| 279 | 290 |
| 280 using ZombieStreamMap = | 291 using ZombieStreamMap = |
| 281 QuicSmallMap<QuicStreamId, std::unique_ptr<QuicStream>, 10>; | 292 QuicSmallMap<QuicStreamId, std::unique_ptr<QuicStream>, 10>; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 QuicStreamId currently_writing_stream_id_; | 520 QuicStreamId currently_writing_stream_id_; |
| 510 | 521 |
| 511 // If this is set to false, the session will ignore peer GOAWAYs and | 522 // If this is set to false, the session will ignore peer GOAWAYs and |
| 512 // allow the creation of outgoing streams regardless of the high | 523 // allow the creation of outgoing streams regardless of the high |
| 513 // chance they will fail. | 524 // chance they will fail. |
| 514 bool respect_goaway_; | 525 bool respect_goaway_; |
| 515 | 526 |
| 516 // This session is notified on every ack or loss. | 527 // This session is notified on every ack or loss. |
| 517 const bool use_stream_notifier_; | 528 const bool use_stream_notifier_; |
| 518 | 529 |
| 530 // Streams of this session own their outstanding data. Outstanding data here |
| 531 // means sent data waiting to be acked. |
| 532 const bool streams_own_data_; |
| 533 |
| 519 DISALLOW_COPY_AND_ASSIGN(QuicSession); | 534 DISALLOW_COPY_AND_ASSIGN(QuicSession); |
| 520 }; | 535 }; |
| 521 | 536 |
| 522 } // namespace net | 537 } // namespace net |
| 523 | 538 |
| 524 #endif // NET_QUIC_CORE_QUIC_SESSION_H_ | 539 #endif // NET_QUIC_CORE_QUIC_SESSION_H_ |
| OLD | NEW |