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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 uint64 stream_bytes_written() const { return stream_bytes_written_; } | 85 uint64 stream_bytes_written() const { return stream_bytes_written_; } |
86 | 86 |
87 QuicVersion version() const; | 87 QuicVersion version() const; |
88 | 88 |
89 void set_fin_sent(bool fin_sent) { fin_sent_ = fin_sent; } | 89 void set_fin_sent(bool fin_sent) { fin_sent_ = fin_sent; } |
90 void set_rst_sent(bool rst_sent) { rst_sent_ = rst_sent; } | 90 void set_rst_sent(bool rst_sent) { rst_sent_ = rst_sent; } |
91 | 91 |
92 // Adjust our flow control windows according to new offset in |frame|. | 92 // Adjust our flow control windows according to new offset in |frame|. |
93 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); | 93 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); |
94 | 94 |
95 // If our receive window has dropped below the threshold, then send a | |
96 // WINDOW_UPDATE frame. This is called whenever bytes are consumed from the | |
97 // sequencer's buffer. | |
98 void MaybeSendWindowUpdate(); | |
99 | |
100 int num_frames_received() const; | 95 int num_frames_received() const; |
101 | 96 |
102 int num_duplicate_frames_received() const; | 97 int num_duplicate_frames_received() const; |
103 | 98 |
104 QuicFlowController* flow_controller() { return &flow_controller_; } | 99 QuicFlowController* flow_controller() { return &flow_controller_; } |
105 | 100 |
106 // Called by the stream sequeuncer as bytes are added to the buffer. | 101 // Called by the stream sequencer as bytes are added to the buffer. |
107 void AddBytesBuffered(uint64 bytes); | 102 void AddBytesBuffered(uint64 bytes); |
108 // Called by the stream sequeuncer as bytes are removed from the buffer. | 103 // Called by the stream sequencer as bytes are removed from the buffer. |
109 void RemoveBytesBuffered(uint64 bytes); | 104 void RemoveBytesBuffered(uint64 bytes); |
110 // Called when bytese are sent to the peer. | 105 // Called when bytes are sent to the peer. |
111 void AddBytesSent(uint64 bytes); | 106 void AddBytesSent(uint64 bytes); |
112 // Called by the stream sequeuncer 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 |
| 109 // WINDOW_UPDATE frame. |
113 void AddBytesConsumed(uint64 bytes); | 110 void AddBytesConsumed(uint64 bytes); |
114 | 111 |
115 // 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 |
116 // control window or the connection flow control window. | 113 // control window or the connection flow control window. |
117 bool IsFlowControlBlocked(); | 114 bool IsFlowControlBlocked(); |
118 | 115 |
119 protected: | 116 protected: |
120 // Sends as much of 'data' to the connection as the connection will consume, | 117 // Sends as much of 'data' to the connection as the connection will consume, |
121 // and then buffers any remaining data in queued_data_. | 118 // and then buffers any remaining data in queued_data_. |
122 void WriteOrBufferData( | 119 void WriteOrBufferData( |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 216 |
220 // The connection level flow controller. Not owned. | 217 // The connection level flow controller. Not owned. |
221 QuicFlowController* connection_flow_controller_; | 218 QuicFlowController* connection_flow_controller_; |
222 | 219 |
223 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); | 220 DISALLOW_COPY_AND_ASSIGN(ReliableQuicStream); |
224 }; | 221 }; |
225 | 222 |
226 } // namespace net | 223 } // namespace net |
227 | 224 |
228 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ | 225 #endif // NET_QUIC_RELIABLE_QUIC_STREAM_H_ |
OLD | NEW |