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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // OnDataAvailable(). | 172 // OnDataAvailable(). |
173 // When the FIN is received, the stream will be notified automatically (via | 173 // When the FIN is received, the stream will be notified automatically (via |
174 // OnFinRead()) (which may happen during the call of StopReading()). | 174 // OnFinRead()) (which may happen during the call of StopReading()). |
175 // TODO(dworley): There should be machinery to send a RST_STREAM/NO_ERROR and | 175 // TODO(dworley): There should be machinery to send a RST_STREAM/NO_ERROR and |
176 // stop sending stream-level flow-control updates when this end sends FIN. | 176 // stop sending stream-level flow-control updates when this end sends FIN. |
177 virtual void StopReading(); | 177 virtual void StopReading(); |
178 | 178 |
179 // Get peer IP of the lastest packet which connection is dealing/delt with. | 179 // Get peer IP of the lastest packet which connection is dealing/delt with. |
180 virtual const QuicSocketAddress& PeerAddressOfLatestPacket() const; | 180 virtual const QuicSocketAddress& PeerAddressOfLatestPacket() const; |
181 | 181 |
182 protected: | |
183 // Sends as much of 'data' to the connection as the connection will consume, | 182 // Sends as much of 'data' to the connection as the connection will consume, |
184 // and then buffers any remaining data in queued_data_. | 183 // and then buffers any remaining data in queued_data_. |
185 // If fin is true: if it is immediately passed on to the session, | 184 // If fin is true: if it is immediately passed on to the session, |
186 // write_side_closed() becomes true, otherwise fin_buffered_ becomes true. | 185 // write_side_closed() becomes true, otherwise fin_buffered_ becomes true. |
187 void WriteOrBufferData( | 186 void WriteOrBufferData( |
188 base::StringPiece data, | 187 base::StringPiece data, |
189 bool fin, | 188 bool fin, |
190 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); | 189 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); |
191 | 190 |
| 191 protected: |
192 // Sends as many bytes in the first |count| buffers of |iov| to the connection | 192 // Sends as many bytes in the first |count| buffers of |iov| to the connection |
193 // as the connection will consume. | 193 // as the connection will consume. |
194 // If |ack_listener| is provided, then it will be notified once all | 194 // If |ack_listener| is provided, then it will be notified once all |
195 // the ACKs for this write have been received. | 195 // the ACKs for this write have been received. |
196 // Returns the number of bytes consumed by the connection. | 196 // Returns the number of bytes consumed by the connection. |
197 QuicConsumedData WritevData( | 197 QuicConsumedData WritevData( |
198 const struct iovec* iov, | 198 const struct iovec* iov, |
199 int iov_count, | 199 int iov_count, |
200 bool fin, | 200 bool fin, |
201 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); | 201 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 // For debugging only, used for busy loop check. | 318 // For debugging only, used for busy loop check. |
319 size_t busy_counter_; | 319 size_t busy_counter_; |
320 | 320 |
321 DISALLOW_COPY_AND_ASSIGN(QuicStream); | 321 DISALLOW_COPY_AND_ASSIGN(QuicStream); |
322 }; | 322 }; |
323 | 323 |
324 } // namespace net | 324 } // namespace net |
325 | 325 |
326 #endif // NET_QUIC_CORE_QUIC_STREAM_H_ | 326 #endif // NET_QUIC_CORE_QUIC_STREAM_H_ |
OLD | NEW |