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 // Responsible for generating packets on behalf of a QuicConnection. | 5 // Responsible for generating packets on behalf of a QuicConnection. |
6 // Packets are serialized just-in-time. Control frames are queued. | 6 // Packets are serialized just-in-time. Control frames are queued. |
7 // Ack and Feedback frames will be requested from the Connection | 7 // Ack and Feedback frames will be requested from the Connection |
8 // just-in-time. When a packet needs to be sent, the Generator | 8 // just-in-time. When a packet needs to be sent, the Generator |
9 // will serialize a packet and pass it to QuicConnection::SendOrQueuePacket() | 9 // will serialize a packet and pass it to QuicConnection::SendOrQueuePacket() |
10 // | 10 // |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 // Sets |path_id| to be the path on which next packet is generated. | 175 // Sets |path_id| to be the path on which next packet is generated. |
176 void SetCurrentPath(QuicPathId path_id, | 176 void SetCurrentPath(QuicPathId path_id, |
177 QuicPacketNumber least_packet_awaited_by_peer, | 177 QuicPacketNumber least_packet_awaited_by_peer, |
178 QuicPacketCount max_packets_in_flight); | 178 QuicPacketCount max_packets_in_flight); |
179 | 179 |
180 void set_debug_delegate(QuicPacketCreator::DebugDelegate* debug_delegate) { | 180 void set_debug_delegate(QuicPacketCreator::DebugDelegate* debug_delegate) { |
181 packet_creator_.set_debug_delegate(debug_delegate); | 181 packet_creator_.set_debug_delegate(debug_delegate); |
182 } | 182 } |
183 | 183 |
184 const QuicAckFrame& pending_ack_frame() const { return pending_ack_frame_; } | |
185 | |
186 private: | 184 private: |
187 friend class test::QuicPacketGeneratorPeer; | 185 friend class test::QuicPacketGeneratorPeer; |
188 | 186 |
189 void SendQueuedFrames(bool flush); | 187 void SendQueuedFrames(bool flush); |
190 | 188 |
191 // Test to see if we have pending ack, or control frames. | 189 // Test to see if we have pending ack, or control frames. |
192 bool HasPendingFrames() const; | 190 bool HasPendingFrames() const; |
193 // Returns true if addition of a pending frame (which might be | 191 // Returns true if addition of a pending frame (which might be |
194 // retransmittable) would still allow the resulting packet to be sent now. | 192 // retransmittable) would still allow the resulting packet to be sent now. |
195 bool CanSendWithNextPendingFrameAddition() const; | 193 bool CanSendWithNextPendingFrameAddition() const; |
(...skipping 11 matching lines...) Expand all Loading... |
207 // True if batch mode is currently enabled. | 205 // True if batch mode is currently enabled. |
208 bool batch_mode_; | 206 bool batch_mode_; |
209 | 207 |
210 // Flags to indicate the need for just-in-time construction of a frame. | 208 // Flags to indicate the need for just-in-time construction of a frame. |
211 bool should_send_ack_; | 209 bool should_send_ack_; |
212 bool should_send_stop_waiting_; | 210 bool should_send_stop_waiting_; |
213 // If we put a non-retransmittable frame in this packet, then we have to hold | 211 // If we put a non-retransmittable frame in this packet, then we have to hold |
214 // a reference to it until we flush (and serialize it). Retransmittable frames | 212 // a reference to it until we flush (and serialize it). Retransmittable frames |
215 // are referenced elsewhere so that they can later be (optionally) | 213 // are referenced elsewhere so that they can later be (optionally) |
216 // retransmitted. | 214 // retransmitted. |
217 QuicAckFrame pending_ack_frame_; | |
218 QuicStopWaitingFrame pending_stop_waiting_frame_; | 215 QuicStopWaitingFrame pending_stop_waiting_frame_; |
219 | 216 |
220 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); | 217 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); |
221 }; | 218 }; |
222 | 219 |
223 } // namespace net | 220 } // namespace net |
224 | 221 |
225 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ | 222 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ |
OLD | NEW |