| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 bool WillAcceptStreamFrame(const QuicStreamFrame& frame) const; | 48 bool WillAcceptStreamFrame(const QuicStreamFrame& frame) const; |
| 49 virtual bool OnStreamFrame(const QuicStreamFrame& frame); | 49 virtual bool OnStreamFrame(const QuicStreamFrame& frame); |
| 50 | 50 |
| 51 virtual void OnCanWrite(); | 51 virtual void OnCanWrite(); |
| 52 | 52 |
| 53 // Called by the session just before the stream is deleted. | 53 // Called by the session just before the stream is deleted. |
| 54 virtual void OnClose(); | 54 virtual void OnClose(); |
| 55 | 55 |
| 56 // Called when we get a stream reset from the client. | 56 // Called when we get a stream reset from the client. |
| 57 // The rst will be passed through the sequencer, which will call | 57 void OnStreamReset(QuicErrorCode error); |
| 58 // TerminateFromPeer when 'offset' bytes have been processed. | |
| 59 void OnStreamReset(QuicErrorCode error, QuicStreamOffset ofset); | |
| 60 | 58 |
| 61 // Called when we get or send a connection close, and should immediately | 59 // Called when we get or send a connection close, and should immediately |
| 62 // close the stream. This is not passed through the sequencer, | 60 // close the stream. This is not passed through the sequencer, |
| 63 // but is handled immediately. | 61 // but is handled immediately. |
| 64 virtual void ConnectionClose(QuicErrorCode error, bool from_peer); | 62 virtual void ConnectionClose(QuicErrorCode error, bool from_peer); |
| 65 | 63 |
| 66 // Called by the sequencer, when we should process a stream termination or | 64 // Called by the sequencer, when we should process a stream termination or |
| 67 // stream close from the peer. | 65 // stream close from the peer. |
| 68 virtual void TerminateFromPeer(bool half_close); | 66 virtual void TerminateFromPeer(bool half_close); |
| 69 | 67 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 QuicConsumedData WriteDataInternal(base::StringPiece data, bool fin); | 117 QuicConsumedData WriteDataInternal(base::StringPiece data, bool fin); |
| 120 | 118 |
| 121 private: | 119 private: |
| 122 friend class test::ReliableQuicStreamPeer; | 120 friend class test::ReliableQuicStreamPeer; |
| 123 friend class QuicStreamUtils; | 121 friend class QuicStreamUtils; |
| 124 | 122 |
| 125 std::list<string> queued_data_; | 123 std::list<string> queued_data_; |
| 126 | 124 |
| 127 QuicStreamSequencer sequencer_; | 125 QuicStreamSequencer sequencer_; |
| 128 QuicStreamId id_; | 126 QuicStreamId id_; |
| 129 QuicStreamOffset offset_; | |
| 130 QuicSession* session_; | 127 QuicSession* session_; |
| 131 // Optional visitor of this stream to be notified when the stream is closed. | 128 // Optional visitor of this stream to be notified when the stream is closed. |
| 132 Visitor* visitor_; | 129 Visitor* visitor_; |
| 133 // Bytes read and written refer to payload bytes only: they do not include | 130 // Bytes read and written refer to payload bytes only: they do not include |
| 134 // framing, encryption overhead etc. | 131 // framing, encryption overhead etc. |
| 135 uint64 stream_bytes_read_; | 132 uint64 stream_bytes_read_; |
| 136 uint64 stream_bytes_written_; | 133 uint64 stream_bytes_written_; |
| 137 QuicErrorCode error_; | 134 QuicErrorCode error_; |
| 138 // True if the read side is closed and further frames should be rejected. | 135 // True if the read side is closed and further frames should be rejected. |
| 139 bool read_side_closed_; | 136 bool read_side_closed_; |
| 140 // True if the write side is closed, and further writes should fail. | 137 // True if the write side is closed, and further writes should fail. |
| 141 bool write_side_closed_; | 138 bool write_side_closed_; |
| 142 | 139 |
| 143 bool fin_buffered_; | 140 bool fin_buffered_; |
| 144 bool fin_sent_; | 141 bool fin_sent_; |
| 145 }; | 142 }; |
| 146 | 143 |
| 147 } // namespace net | 144 } // namespace net |
| 148 | 145 |
| 149 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 146 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
| OLD | NEW |