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 reliable streams. | 5 // The base class for client/server reliable streams. |
6 | 6 |
7 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 7 #ifndef NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
8 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 8 #define NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
9 | 9 |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void AddBytesSent(uint64 bytes); | 106 void AddBytesSent(uint64 bytes); |
107 // Called by the stream sequencer as bytes are consumed from the buffer. | 107 // Called by the stream sequencer as bytes are consumed from the buffer. |
108 // If our receive window has dropped below the threshold, then send a | 108 // If our receive window has dropped below the threshold, then send a |
109 // WINDOW_UPDATE frame. | 109 // WINDOW_UPDATE frame. |
110 void AddBytesConsumed(uint64 bytes); | 110 void AddBytesConsumed(uint64 bytes); |
111 | 111 |
112 // Returns true if the stream is flow control blocked, by the stream flow | 112 // Returns true if the stream is flow control blocked, by the stream flow |
113 // control window or the connection flow control window. | 113 // control window or the connection flow control window. |
114 bool IsFlowControlBlocked(); | 114 bool IsFlowControlBlocked(); |
115 | 115 |
| 116 // Returns true if we have received either a RST or a FIN - either of which |
| 117 // gives a definitive number of bytes which the peer has sent. If this is not |
| 118 // true on stream termination the session must keep track of the stream's byte |
| 119 // offset until a definitive final value arrives. |
| 120 bool HasFinalReceivedByteOffset() const { |
| 121 return fin_received_ || rst_received_; |
| 122 } |
| 123 |
116 protected: | 124 protected: |
117 // Sends as much of 'data' to the connection as the connection will consume, | 125 // Sends as much of 'data' to the connection as the connection will consume, |
118 // and then buffers any remaining data in queued_data_. | 126 // and then buffers any remaining data in queued_data_. |
119 void WriteOrBufferData( | 127 void WriteOrBufferData( |
120 base::StringPiece data, | 128 base::StringPiece data, |
121 bool fin, | 129 bool fin, |
122 QuicAckNotifier::DelegateInterface* ack_notifier_delegate); | 130 QuicAckNotifier::DelegateInterface* ack_notifier_delegate); |
123 | 131 |
124 // Sends as many bytes in the first |count| buffers of |iov| to the connection | 132 // Sends as many bytes in the first |count| buffers of |iov| to the connection |
125 // as the connection will consume. | 133 // as the connection will consume. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 QuicErrorCode connection_error_; | 200 QuicErrorCode connection_error_; |
193 | 201 |
194 // True if the read side is closed and further frames should be rejected. | 202 // True if the read side is closed and further frames should be rejected. |
195 bool read_side_closed_; | 203 bool read_side_closed_; |
196 // True if the write side is closed, and further writes should fail. | 204 // True if the write side is closed, and further writes should fail. |
197 bool write_side_closed_; | 205 bool write_side_closed_; |
198 | 206 |
199 bool fin_buffered_; | 207 bool fin_buffered_; |
200 bool fin_sent_; | 208 bool fin_sent_; |
201 | 209 |
| 210 // True if this stream has received (and the sequencer has accepted) a |
| 211 // StreamFrame with the FIN set. |
| 212 bool fin_received_; |
| 213 |
202 // In combination with fin_sent_, used to ensure that a FIN and/or a RST is | 214 // In combination with fin_sent_, used to ensure that a FIN and/or a RST is |
203 // always sent before stream termination. | 215 // always sent before stream termination. |
204 bool rst_sent_; | 216 bool rst_sent_; |
205 | 217 |
| 218 // True if this stream has received a RST stream frame. |
| 219 bool rst_received_; |
| 220 |
206 // True if the session this stream is running under is a server session. | 221 // True if the session this stream is running under is a server session. |
207 bool is_server_; | 222 bool is_server_; |
208 | 223 |
209 QuicFlowController flow_controller_; | 224 QuicFlowController flow_controller_; |
210 | 225 |
211 // The connection level flow controller. Not owned. | 226 // The connection level flow controller. Not owned. |
212 QuicFlowController* connection_flow_controller_; | 227 QuicFlowController* connection_flow_controller_; |
213 | 228 |
214 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); | 229 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); |
215 }; | 230 }; |
216 | 231 |
217 } // namespace net | 232 } // namespace net |
218 | 233 |
219 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 234 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
OLD | NEW |