| 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 // The base class for client/server QUIC streams. | 5 // The base class for client/server QUIC streams. |
| 6 | 6 |
| 7 // It does not contain the entire interface needed by an application to interact | 7 // It does not contain the entire interface needed by an application to interact |
| 8 // with a QUIC stream. Some parts of the interface must be obtained by | 8 // with a QUIC stream. Some parts of the interface must be obtained by |
| 9 // accessing the owning session object. A subclass of QuicStream | 9 // accessing the owning session object. A subclass of QuicStream |
| 10 // connects the object and the application that generates and consumes the data | 10 // connects the object and the application that generates and consumes the data |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 // Called by the subclass or the sequencer to reset the stream from this | 86 // Called by the subclass or the sequencer to reset the stream from this |
| 87 // end. | 87 // end. |
| 88 virtual void Reset(QuicRstStreamErrorCode error); | 88 virtual void Reset(QuicRstStreamErrorCode error); |
| 89 | 89 |
| 90 // Called by the subclass or the sequencer to close the entire connection from | 90 // Called by the subclass or the sequencer to close the entire connection from |
| 91 // this end. | 91 // this end. |
| 92 virtual void CloseConnectionWithDetails(QuicErrorCode error, | 92 virtual void CloseConnectionWithDetails(QuicErrorCode error, |
| 93 const std::string& details); | 93 const std::string& details); |
| 94 | 94 |
| 95 // Returns true if this stream is still waiting for acks of sent data. |
| 96 // This will return false if all data has been acked, or if the stream |
| 97 // is no longer interested in data being acked (which happens when |
| 98 // a stream is reset because of an error). |
| 99 bool IsWaitingForAcks() const; |
| 100 |
| 95 QuicStreamId id() const { return id_; } | 101 QuicStreamId id() const { return id_; } |
| 96 | 102 |
| 97 QuicRstStreamErrorCode stream_error() const { return stream_error_; } | 103 QuicRstStreamErrorCode stream_error() const { return stream_error_; } |
| 98 QuicErrorCode connection_error() const { return connection_error_; } | 104 QuicErrorCode connection_error() const { return connection_error_; } |
| 99 | 105 |
| 100 bool reading_stopped() const { | 106 bool reading_stopped() const { |
| 101 return sequencer_.ignore_read_data() || read_side_closed_; | 107 return sequencer_.ignore_read_data() || read_side_closed_; |
| 102 } | 108 } |
| 103 bool write_side_closed() const { return write_side_closed_; } | 109 bool write_side_closed() const { return write_side_closed_; } |
| 104 | 110 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 119 size_t busy_counter() const { return busy_counter_; } | 125 size_t busy_counter() const { return busy_counter_; } |
| 120 void set_busy_counter(size_t busy_counter) { busy_counter_ = busy_counter; } | 126 void set_busy_counter(size_t busy_counter) { busy_counter_ = busy_counter; } |
| 121 | 127 |
| 122 void set_fin_sent(bool fin_sent) { fin_sent_ = fin_sent; } | 128 void set_fin_sent(bool fin_sent) { fin_sent_ = fin_sent; } |
| 123 void set_fin_received(bool fin_received) { fin_received_ = fin_received; } | 129 void set_fin_received(bool fin_received) { fin_received_ = fin_received; } |
| 124 void set_rst_sent(bool rst_sent) { rst_sent_ = rst_sent; } | 130 void set_rst_sent(bool rst_sent) { rst_sent_ = rst_sent; } |
| 125 | 131 |
| 126 void set_rst_received(bool rst_received) { rst_received_ = rst_received; } | 132 void set_rst_received(bool rst_received) { rst_received_ = rst_received; } |
| 127 void set_stream_error(QuicRstStreamErrorCode error) { stream_error_ = error; } | 133 void set_stream_error(QuicRstStreamErrorCode error) { stream_error_ = error; } |
| 128 | 134 |
| 129 bool is_deletable() const { return is_deletable_; } | |
| 130 | |
| 131 // Adjust the flow control window according to new offset in |frame|. | 135 // Adjust the flow control window according to new offset in |frame|. |
| 132 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); | 136 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); |
| 133 | 137 |
| 134 // Used in Chrome. | 138 // Used in Chrome. |
| 135 int num_frames_received() const; | 139 int num_frames_received() const; |
| 136 int num_duplicate_frames_received() const; | 140 int num_duplicate_frames_received() const; |
| 137 | 141 |
| 138 QuicFlowController* flow_controller() { return &flow_controller_; } | 142 QuicFlowController* flow_controller() { return &flow_controller_; } |
| 139 | 143 |
| 140 // Called when endpoint receives a frame which could increase the highest | 144 // Called when endpoint receives a frame which could increase the highest |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // If fin is true: if it is immediately passed on to the session, | 189 // If fin is true: if it is immediately passed on to the session, |
| 186 // write_side_closed() becomes true, otherwise fin_buffered_ becomes true. | 190 // write_side_closed() becomes true, otherwise fin_buffered_ becomes true. |
| 187 void WriteOrBufferData( | 191 void WriteOrBufferData( |
| 188 QuicStringPiece data, | 192 QuicStringPiece data, |
| 189 bool fin, | 193 bool fin, |
| 190 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); | 194 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); |
| 191 | 195 |
| 192 // Adds random padding after the fin is consumed for this stream. | 196 // Adds random padding after the fin is consumed for this stream. |
| 193 void AddRandomPaddingAfterFin(); | 197 void AddRandomPaddingAfterFin(); |
| 194 | 198 |
| 195 // Sets this stream as deletable. Delete this stream from zombie stream map if | |
| 196 // exists. | |
| 197 void SetIsDeletable(bool is_deletable); | |
| 198 | |
| 199 // StreamNotifierInterface methods: | 199 // StreamNotifierInterface methods: |
| 200 void OnStreamFrameAcked(const QuicStreamFrame& frame, | 200 void OnStreamFrameAcked(const QuicStreamFrame& frame, |
| 201 QuicTime::Delta ack_delay_time) override; | 201 QuicTime::Delta ack_delay_time) override; |
| 202 void OnStreamFrameRetransmitted(const QuicStreamFrame& frame) override; | 202 void OnStreamFrameRetransmitted(const QuicStreamFrame& frame) override; |
| 203 | 203 |
| 204 protected: | 204 protected: |
| 205 // Sends as many bytes in the first |count| buffers of |iov| to the connection | 205 // Sends as many bytes in the first |count| buffers of |iov| to the connection |
| 206 // as the connection will consume. | 206 // as the connection will consume. |
| 207 // If |ack_listener| is provided, then it will be notified once all | 207 // If |ack_listener| is provided, then it will be notified once all |
| 208 // the ACKs for this write have been received. | 208 // the ACKs for this write have been received. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 bool fin_received_; | 316 bool fin_received_; |
| 317 | 317 |
| 318 // True if an RST_STREAM has been sent to the session. | 318 // True if an RST_STREAM has been sent to the session. |
| 319 // In combination with fin_sent_, used to ensure that a FIN and/or a | 319 // In combination with fin_sent_, used to ensure that a FIN and/or a |
| 320 // RST_STREAM is always sent to terminate the stream. | 320 // RST_STREAM is always sent to terminate the stream. |
| 321 bool rst_sent_; | 321 bool rst_sent_; |
| 322 | 322 |
| 323 // True if this stream has received a RST_STREAM frame. | 323 // True if this stream has received a RST_STREAM frame. |
| 324 bool rst_received_; | 324 bool rst_received_; |
| 325 | 325 |
| 326 // True if this stream object may be deleted. Currently, this means this | |
| 327 // stream does not have unacked data (including FIN). Please note, this stream | |
| 328 // may not finish sending. | |
| 329 bool is_deletable_; | |
| 330 | |
| 331 // Tracks if the session this stream is running under was created by a | 326 // Tracks if the session this stream is running under was created by a |
| 332 // server or a client. | 327 // server or a client. |
| 333 Perspective perspective_; | 328 Perspective perspective_; |
| 334 | 329 |
| 335 QuicFlowController flow_controller_; | 330 QuicFlowController flow_controller_; |
| 336 | 331 |
| 337 // The connection level flow controller. Not owned. | 332 // The connection level flow controller. Not owned. |
| 338 QuicFlowController* connection_flow_controller_; | 333 QuicFlowController* connection_flow_controller_; |
| 339 | 334 |
| 340 // Special streams, such as the crypto and headers streams, do not respect | 335 // Special streams, such as the crypto and headers streams, do not respect |
| (...skipping 12 matching lines...) Expand all Loading... |
| 353 // Ack listener of this stream, and it is notified when any of written bytes | 348 // Ack listener of this stream, and it is notified when any of written bytes |
| 354 // are acked. | 349 // are acked. |
| 355 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener_; | 350 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener_; |
| 356 | 351 |
| 357 DISALLOW_COPY_AND_ASSIGN(QuicStream); | 352 DISALLOW_COPY_AND_ASSIGN(QuicStream); |
| 358 }; | 353 }; |
| 359 | 354 |
| 360 } // namespace net | 355 } // namespace net |
| 361 | 356 |
| 362 #endif // NET_QUIC_CORE_QUIC_STREAM_H_ | 357 #endif // NET_QUIC_CORE_QUIC_STREAM_H_ |
| OLD | NEW |