Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: net/quic/quic_packet_creator.h

Issue 1784903003: Remove FEC from send path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@114770052
Patch Set: Restore accidentally removed OnRttChanged call Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_headers_stream_test.cc ('k') | net/quic/quic_packet_creator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Accumulates frames for the next packet until more frames no longer fit or 5 // Accumulates frames for the next packet until more frames no longer fit or
6 // it's time to create a packet from them. Also provides packet creation of 6 // it's time to create a packet from them. If multipath enabled, only creates
7 // FEC packets based on previously created packets. If multipath enabled, only 7 // packets on one path at the same time. Currently, next packet number is
8 // creates packets on one path at the same time. Currently, next packet number 8 // tracked per-path.
9 // is tracked per-path.
10 9
11 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ 10 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_
12 #define NET_QUIC_QUIC_PACKET_CREATOR_H_ 11 #define NET_QUIC_QUIC_PACKET_CREATOR_H_
13 12
14 #include <stddef.h> 13 #include <stddef.h>
15 14
16 #include <string> 15 #include <string>
17 #include <unordered_map> 16 #include <unordered_map>
18 #include <utility> 17 #include <utility>
19 #include <vector> 18 #include <vector>
20 19
21 #include "base/macros.h" 20 #include "base/macros.h"
22 #include "base/memory/scoped_ptr.h" 21 #include "base/memory/scoped_ptr.h"
23 #include "base/strings/string_piece.h" 22 #include "base/strings/string_piece.h"
24 #include "net/quic/quic_fec_group.h"
25 #include "net/quic/quic_framer.h" 23 #include "net/quic/quic_framer.h"
26 #include "net/quic/quic_protocol.h" 24 #include "net/quic/quic_protocol.h"
27 25
28 using base::hash_map; 26 using base::hash_map;
29 27
30 namespace net { 28 namespace net {
31 namespace test { 29 namespace test {
32 class QuicPacketCreatorPeer; 30 class QuicPacketCreatorPeer;
33 } 31 }
34 32
35 class QuicRandom; 33 class QuicRandom;
36 class QuicRandomBoolSource; 34 class QuicRandomBoolSource;
37 35
38 class NET_EXPORT_PRIVATE QuicPacketCreator { 36 class NET_EXPORT_PRIVATE QuicPacketCreator {
39 public: 37 public:
40 // A delegate interface for further processing serialized packet. 38 // A delegate interface for further processing serialized packet.
41 class NET_EXPORT_PRIVATE DelegateInterface { 39 class NET_EXPORT_PRIVATE DelegateInterface {
42 public: 40 public:
43 virtual ~DelegateInterface() {} 41 virtual ~DelegateInterface() {}
44 // Called when a packet is serialized. Delegate does not take the ownership 42 // Called when a packet is serialized. Delegate does not take the ownership
45 // of |serialized_packet|, but may take ownership of |packet.packet| 43 // of |serialized_packet|, but may take ownership of |packet.packet|
46 // and |packet.retransmittable_frames|. If it does so, they must be set 44 // and |packet.retransmittable_frames|. If it does so, they must be set
47 // to nullptr. 45 // to nullptr.
48 virtual void OnSerializedPacket(SerializedPacket* serialized_packet) = 0; 46 virtual void OnSerializedPacket(SerializedPacket* serialized_packet) = 0;
49 47
50 // Called when an unrecoverable error is encountered. 48 // Called when an unrecoverable error is encountered.
51 virtual void OnUnrecoverableError(QuicErrorCode error, 49 virtual void OnUnrecoverableError(QuicErrorCode error,
52 ConnectionCloseSource source) = 0; 50 ConnectionCloseSource source) = 0;
53
54 // Called when current FEC group is reset (closed).
55 virtual void OnResetFecGroup() = 0;
56 }; 51 };
57 52
58 // Interface which gets callbacks from the QuicPacketCreator at interesting 53 // Interface which gets callbacks from the QuicPacketCreator at interesting
59 // points. Implementations must not mutate the state of the creator 54 // points. Implementations must not mutate the state of the creator
60 // as a result of these callbacks. 55 // as a result of these callbacks.
61 class NET_EXPORT_PRIVATE DebugDelegate { 56 class NET_EXPORT_PRIVATE DebugDelegate {
62 public: 57 public:
63 virtual ~DebugDelegate() {} 58 virtual ~DebugDelegate() {}
64 59
65 // Called when a frame has been added to the current packet. 60 // Called when a frame has been added to the current packet.
66 virtual void OnFrameAddedToPacket(const QuicFrame& frame) {} 61 virtual void OnFrameAddedToPacket(const QuicFrame& frame) {}
67 }; 62 };
68 63
69 // QuicRandom* required for packet entropy. 64 // QuicRandom* required for packet entropy.
70 QuicPacketCreator(QuicConnectionId connection_id, 65 QuicPacketCreator(QuicConnectionId connection_id,
71 QuicFramer* framer, 66 QuicFramer* framer,
72 QuicRandom* random_generator, 67 QuicRandom* random_generator,
73 QuicBufferAllocator* buffer_allocator, 68 QuicBufferAllocator* buffer_allocator,
74 DelegateInterface* delegate); 69 DelegateInterface* delegate);
75 70
76 ~QuicPacketCreator(); 71 ~QuicPacketCreator();
77 72
78 // Checks if it's time to send an FEC packet. |force_close| forces this to
79 // return true if an FEC group is open.
80 bool ShouldSendFec(bool force_close) const;
81
82 // If ShouldSendFec returns true, serializes currently constructed FEC packet
83 // and calls the delegate on the packet. Resets current FEC group if FEC
84 // protection policy is FEC_ALARM_TRIGGER but |is_fec_timeout| is false.
85 // Also tries to turn off FEC protection if should_fec_protect_next_packet is
86 // false.
87 void MaybeSendFecPacketAndCloseGroup(bool force_send_fec,
88 bool is_fec_timeout);
89
90 // Returns true if an FEC packet is under construction.
91 bool IsFecGroupOpen() const;
92
93 // Called after sending |packet_number| to determine whether an FEC alarm
94 // should be set for sending out an FEC packet. Returns a positive and finite
95 // timeout if an FEC alarm should be set, and infinite if no alarm should be
96 // set.
97 QuicTime::Delta GetFecTimeout(QuicPacketNumber packet_number);
98
99 // Makes the framer not serialize the protocol version in sent packets. 73 // Makes the framer not serialize the protocol version in sent packets.
100 void StopSendingVersion(); 74 void StopSendingVersion();
101 75
102 // Update the packet number length to use in future packets as soon as it 76 // Update the packet number length to use in future packets as soon as it
103 // can be safely changed. 77 // can be safely changed.
104 // TODO(fayang): Directly set packet number length instead of compute it in 78 // TODO(fayang): Directly set packet number length instead of compute it in
105 // creator. 79 // creator.
106 void UpdatePacketNumberLength(QuicPacketNumber least_packet_awaited_by_peer, 80 void UpdatePacketNumberLength(QuicPacketNumber least_packet_awaited_by_peer,
107 QuicPacketCount max_packets_in_flight); 81 QuicPacketCount max_packets_in_flight);
108 82
109 // The overhead the framing will add for a packet with one frame. 83 // The overhead the framing will add for a packet with one frame.
110 static size_t StreamFramePacketOverhead( 84 static size_t StreamFramePacketOverhead(
111 QuicConnectionIdLength connection_id_length, 85 QuicConnectionIdLength connection_id_length,
112 bool include_version, 86 bool include_version,
113 bool include_path_id, 87 bool include_path_id,
114 QuicPacketNumberLength packet_number_length, 88 QuicPacketNumberLength packet_number_length,
115 QuicStreamOffset offset, 89 QuicStreamOffset offset,
116 InFecGroup is_in_fec_group); 90 InFecGroup is_in_fec_group);
117 91
118 // Returns false and flushes all pending frames if current open packet is 92 // Returns false and flushes all pending frames if current open packet is
119 // full. 93 // full.
120 // If current packet is not full, converts a raw payload into a stream frame 94 // If current packet is not full, converts a raw payload into a stream frame
121 // that fits into the open packet and adds it to the packet. 95 // that fits into the open packet and adds it to the packet.
122 // The payload begins at |iov_offset| into the |iov|. 96 // The payload begins at |iov_offset| into the |iov|.
123 // Also tries to start FEC protection depends on |fec_protection|.
124 bool ConsumeData(QuicStreamId id, 97 bool ConsumeData(QuicStreamId id,
125 QuicIOVector iov, 98 QuicIOVector iov,
126 size_t iov_offset, 99 size_t iov_offset,
127 QuicStreamOffset offset, 100 QuicStreamOffset offset,
128 bool fin, 101 bool fin,
129 bool needs_padding, 102 bool needs_padding,
130 QuicFrame* frame, 103 QuicFrame* frame);
131 FecProtection fec_protection);
132 104
133 // Returns true if current open packet can accommodate more stream frames of 105 // Returns true if current open packet can accommodate more stream frames of
134 // stream |id| at |offset|, false otherwise. 106 // stream |id| at |offset|, false otherwise.
135 bool HasRoomForStreamFrame(QuicStreamId id, QuicStreamOffset offset); 107 bool HasRoomForStreamFrame(QuicStreamId id, QuicStreamOffset offset);
136 108
137 // Re-serializes frames with the original packet's packet number length. 109 // Re-serializes frames with the original packet's packet number length.
138 // Used for retransmitting packets to ensure they aren't too long. 110 // Used for retransmitting packets to ensure they aren't too long.
139 // Caller must ensure that any open FEC group is closed before calling this
140 // method.
141 void ReserializeAllFrames(const PendingRetransmission& retransmission, 111 void ReserializeAllFrames(const PendingRetransmission& retransmission,
142 char* buffer, 112 char* buffer,
143 size_t buffer_len); 113 size_t buffer_len);
144 114
145 // Serializes all added frames into a single packet and invokes the delegate_ 115 // Serializes all added frames into a single packet and invokes the delegate_
146 // to further process the SerializedPacket. 116 // to further process the SerializedPacket.
147 void Flush(); 117 void Flush();
148 118
149 // Returns true if there are frames pending to be serialized. 119 // Returns true if there are frames pending to be serialized.
150 bool HasPendingFrames() const; 120 bool HasPendingFrames() const;
151 121
152 // Returns true if there are retransmittable frames pending to be serialized. 122 // Returns true if there are retransmittable frames pending to be serialized.
153 bool HasPendingRetransmittableFrames() const; 123 bool HasPendingRetransmittableFrames() const;
154 124
155 // Returns the number of bytes which are available to be used by additional 125 // Returns the number of bytes which are available to be used by additional
156 // frames in the packet. Since stream frames are slightly smaller when they 126 // frames in the packet. Since stream frames are slightly smaller when they
157 // are the last frame in a packet, this method will return a different 127 // are the last frame in a packet, this method will return a different
158 // value than max_packet_size - PacketSize(), in this case. 128 // value than max_packet_size - PacketSize(), in this case.
159 size_t BytesFree(); 129 size_t BytesFree();
160 130
161 // Returns the number of bytes that the packet will expand by if a new frame 131 // Returns the number of bytes that the packet will expand by if a new frame
162 // is added to the packet. If the last frame was a stream frame, it will 132 // is added to the packet. If the last frame was a stream frame, it will
163 // expand slightly when a new frame is added, and this method returns the 133 // expand slightly when a new frame is added, and this method returns the
164 // amount of expected expansion. If the packet is in an FEC group, no 134 // amount of expected expansion.
165 // expansion happens and this method always returns zero.
166 size_t ExpansionOnNewFrame() const; 135 size_t ExpansionOnNewFrame() const;
167 136
168 // Returns the number of bytes in the current packet, including the header, 137 // Returns the number of bytes in the current packet, including the header,
169 // if serialized with the current frames. Adding a frame to the packet 138 // if serialized with the current frames. Adding a frame to the packet
170 // may change the serialized length of existing frames, as per the comment 139 // may change the serialized length of existing frames, as per the comment
171 // in BytesFree. 140 // in BytesFree.
172 size_t PacketSize(); 141 size_t PacketSize();
173 142
174 // Tries to add |frame| to the packet creator's list of frames to be 143 // Tries to add |frame| to the packet creator's list of frames to be
175 // serialized. If the frame does not fit into the current packet, flushes the 144 // serialized. If the frame does not fit into the current packet, flushes the
(...skipping 11 matching lines...) Expand all
187 // Creates a version negotiation packet which supports |supported_versions|. 156 // Creates a version negotiation packet which supports |supported_versions|.
188 // Caller owns the created packet. Also, sets the entropy hash of the 157 // Caller owns the created packet. Also, sets the entropy hash of the
189 // serialized packet to a random bool and returns that value as a member of 158 // serialized packet to a random bool and returns that value as a member of
190 // SerializedPacket. 159 // SerializedPacket.
191 QuicEncryptedPacket* SerializeVersionNegotiationPacket( 160 QuicEncryptedPacket* SerializeVersionNegotiationPacket(
192 const QuicVersionVector& supported_versions); 161 const QuicVersionVector& supported_versions);
193 162
194 // Returns a dummy packet that is valid but contains no useful information. 163 // Returns a dummy packet that is valid but contains no useful information.
195 static SerializedPacket NoPacket(); 164 static SerializedPacket NoPacket();
196 165
197 // Called when the congestion window has changed.
198 void OnCongestionWindowChange(QuicPacketCount max_packets_in_flight);
199
200 // Called when the RTT may have changed.
201 void OnRttChange(QuicTime::Delta rtt);
202
203 // Sets the encryption level that will be applied to new packets. 166 // Sets the encryption level that will be applied to new packets.
204 void set_encryption_level(EncryptionLevel level) { 167 void set_encryption_level(EncryptionLevel level) {
205 packet_.encryption_level = level; 168 packet_.encryption_level = level;
206 } 169 }
207 170
208 // packet number of the last created packet, or 0 if no packets have been 171 // packet number of the last created packet, or 0 if no packets have been
209 // created. 172 // created.
210 QuicPacketNumber packet_number() const { return packet_.packet_number; } 173 QuicPacketNumber packet_number() const { return packet_.packet_number; }
211 174
212 QuicConnectionIdLength connection_id_length() const { 175 QuicConnectionIdLength connection_id_length() const {
(...skipping 16 matching lines...) Expand all
229 192
230 // Indicates whether the packet creator is in a state where it can change 193 // Indicates whether the packet creator is in a state where it can change
231 // current maximum packet length. 194 // current maximum packet length.
232 bool CanSetMaxPacketLength() const; 195 bool CanSetMaxPacketLength() const;
233 196
234 // Sets the maximum packet length. 197 // Sets the maximum packet length.
235 void SetMaxPacketLength(QuicByteCount length); 198 void SetMaxPacketLength(QuicByteCount length);
236 199
237 // Sets the path on which subsequent packets will be created. It is the 200 // Sets the path on which subsequent packets will be created. It is the
238 // caller's responsibility to guarantee no packet is under construction before 201 // caller's responsibility to guarantee no packet is under construction before
239 // calling this function. If |path_id| is different from current_path_, the 202 // calling this function. If |path_id| is different from current_path_,
240 // FEC packet (if exists) will be sent and next_packet_number_length_ is 203 // next_packet_number_length_ is recalculated.
241 // recalculated.
242 void SetCurrentPath(QuicPathId path_id, 204 void SetCurrentPath(QuicPathId path_id,
243 QuicPacketNumber least_packet_awaited_by_peer, 205 QuicPacketNumber least_packet_awaited_by_peer,
244 QuicPacketCount max_packets_in_flight); 206 QuicPacketCount max_packets_in_flight);
245 207
246 // Returns current max number of packets covered by an FEC group.
247 size_t max_packets_per_fec_group() const {
248 return max_packets_per_fec_group_;
249 }
250
251 // Sets creator's max number of packets covered by an FEC group.
252 // Note: While there are no constraints on |max_packets_per_fec_group|,
253 // this setter enforces a min value of kLowestMaxPacketsPerFecGroup.
254 // To turn off FEC protection, use StopFecProtectingPackets().
255 void set_max_packets_per_fec_group(size_t max_packets_per_fec_group);
256
257 FecSendPolicy fec_send_policy() { return fec_send_policy_; }
258
259 void set_fec_send_policy(FecSendPolicy fec_send_policy) {
260 fec_send_policy_ = fec_send_policy;
261 }
262
263 void set_rtt_multiplier_for_fec_timeout(
264 float rtt_multiplier_for_fec_timeout) {
265 rtt_multiplier_for_fec_timeout_ = rtt_multiplier_for_fec_timeout;
266 }
267
268 void set_debug_delegate(DebugDelegate* debug_delegate) { 208 void set_debug_delegate(DebugDelegate* debug_delegate) {
269 debug_delegate_ = debug_delegate; 209 debug_delegate_ = debug_delegate;
270 } 210 }
271 211
272 private: 212 private:
273 friend class test::QuicPacketCreatorPeer; 213 friend class test::QuicPacketCreatorPeer;
274 214
275 static bool ShouldRetransmit(const QuicFrame& frame); 215 static bool ShouldRetransmit(const QuicFrame& frame);
276 216
277 // Converts a raw payload to a frame which fits into the current open 217 // Converts a raw payload to a frame which fits into the current open
(...skipping 10 matching lines...) Expand all
288 QuicFrame* frame); 228 QuicFrame* frame);
289 229
290 // Copies |length| bytes from iov starting at offset |iov_offset| into buffer. 230 // Copies |length| bytes from iov starting at offset |iov_offset| into buffer.
291 // |iov| must be at least iov_offset+length total length and buffer must be 231 // |iov| must be at least iov_offset+length total length and buffer must be
292 // at least |length| long. 232 // at least |length| long.
293 static void CopyToBuffer(QuicIOVector iov, 233 static void CopyToBuffer(QuicIOVector iov,
294 size_t iov_offset, 234 size_t iov_offset,
295 size_t length, 235 size_t length,
296 char* buffer); 236 char* buffer);
297 237
298 // Updates lengths and also starts an FEC group if FEC protection is on and 238 // Updates packet number length on packet boundary.
299 // there is not already an FEC group open. 239 void MaybeUpdatePacketNumberLength();
300 InFecGroup MaybeUpdateLengthsAndStartFec();
301 240
302 // Called when a data packet is constructed that is part of an FEC group. 241 void FillPacketHeader(QuicPacketHeader* header);
303 // |payload| is the non-encrypted FEC protected payload of the packet.
304 void OnBuiltFecProtectedPayload(const QuicPacketHeader& header,
305 base::StringPiece payload);
306
307 void FillPacketHeader(QuicFecGroupNumber fec_group,
308 bool fec_flag,
309 QuicPacketHeader* header);
310 242
311 // Adds a |frame| if there is space and returns false and flushes all pending 243 // Adds a |frame| if there is space and returns false and flushes all pending
312 // frames if there isn't room. If |save_retransmittable_frames| is true, 244 // frames if there isn't room. If |save_retransmittable_frames| is true,
313 // saves the |frame| in the next SerializedPacket. 245 // saves the |frame| in the next SerializedPacket.
314 bool AddFrame(const QuicFrame& frame, bool save_retransmittable_frames); 246 bool AddFrame(const QuicFrame& frame, bool save_retransmittable_frames);
315 247
316 // Adds a padding frame to the current packet only if the current packet 248 // Adds a padding frame to the current packet only if the current packet
317 // contains a handshake message, and there is sufficient room to fit a 249 // contains a handshake message, and there is sufficient room to fit a
318 // padding frame. 250 // padding frame.
319 void MaybeAddPadding(); 251 void MaybeAddPadding();
320 252
321 // Serializes all frames which have been added and adds any which should be 253 // Serializes all frames which have been added and adds any which should be
322 // retransmitted to packet_.retransmittable_frames. All frames must fit into 254 // retransmitted to packet_.retransmittable_frames. All frames must fit into
323 // a single packet. Sets the entropy hash of the serialized packet to a 255 // a single packet. Sets the entropy hash of the serialized packet to a
324 // random bool. 256 // random bool.
325 // Fails if |buffer_len| isn't long enough for the encrypted packet. 257 // Fails if |buffer_len| isn't long enough for the encrypted packet.
326 void SerializePacket(char* encrypted_buffer, size_t buffer_len); 258 void SerializePacket(char* encrypted_buffer, size_t buffer_len);
327 259
328 // Called after a new SerialiedPacket is created to call the delegate's 260 // Called after a new SerialiedPacket is created to call the delegate's
329 // OnSerializedPacket, reset state, and potentially flush FEC groups. 261 // OnSerializedPacket and reset state.
330 void OnSerializedPacket(); 262 void OnSerializedPacket();
331 263
332 // Clears all fields of packet_ that should be cleared between serializations. 264 // Clears all fields of packet_ that should be cleared between serializations.
333 void ClearPacket(); 265 void ClearPacket();
334 266
335 // Turn on FEC protection for subsequent packets. If no FEC group is currently
336 // open, this method flushes current open packet and then turns FEC on.
337 void MaybeStartFecProtection();
338
339 // Turn on FEC protection for subsequently created packets. FEC should be
340 // enabled first (max_packets_per_fec_group should be non-zero) for FEC
341 // protection to start.
342 void StartFecProtectingPackets();
343
344 // Turn off FEC protection for subsequently created packets. If the creator
345 // has any open FEC group, call will fail. It is the caller's responsibility
346 // to flush out FEC packets in generation, and to verify with ShouldSendFec()
347 // that there is no open FEC group.
348 void StopFecProtectingPackets();
349
350 // Resets (closes) the FEC group. This method should only be called on a
351 // packet boundary.
352 void ResetFecGroup();
353
354 // Packetize FEC data. Sets the entropy hash of the serialized packet to a
355 // random bool.
356 // Fails if |buffer_len| isn't long enough for the encrypted packet.
357 void SerializeFec(char* buffer, size_t buffer_len);
358
359 // Does not own these delegates or the framer. 267 // Does not own these delegates or the framer.
360 DelegateInterface* delegate_; 268 DelegateInterface* delegate_;
361 DebugDelegate* debug_delegate_; 269 DebugDelegate* debug_delegate_;
362 QuicFramer* framer_; 270 QuicFramer* framer_;
363 271
364 scoped_ptr<QuicRandomBoolSource> random_bool_source_; 272 scoped_ptr<QuicRandomBoolSource> random_bool_source_;
365 QuicBufferAllocator* const buffer_allocator_; 273 QuicBufferAllocator* const buffer_allocator_;
366 274
367 // Controls whether version should be included while serializing the packet. 275 // Controls whether version should be included while serializing the packet.
368 bool send_version_in_packet_; 276 bool send_version_in_packet_;
369 // Controls whether path id should be included while serializing the packet. 277 // Controls whether path id should be included while serializing the packet.
370 bool send_path_id_in_packet_; 278 bool send_path_id_in_packet_;
371 // Staging variable to hold next packet number length. When sequence 279 // Staging variable to hold next packet number length. When sequence
372 // number length is to be changed, this variable holds the new length until 280 // number length is to be changed, this variable holds the new length until
373 // a packet or FEC group boundary, when the creator's packet_number_length_ 281 // a packet boundary, when the creator's packet_number_length_ can be changed
374 // can be changed to this new value. 282 // to this new value.
375 QuicPacketNumberLength next_packet_number_length_; 283 QuicPacketNumberLength next_packet_number_length_;
376 // Maximum length including headers and encryption (UDP payload length.) 284 // Maximum length including headers and encryption (UDP payload length.)
377 QuicByteCount max_packet_length_; 285 QuicByteCount max_packet_length_;
378 size_t max_plaintext_size_; 286 size_t max_plaintext_size_;
379 // Length of connection_id to send over the wire. 287 // Length of connection_id to send over the wire.
380 QuicConnectionIdLength connection_id_length_; 288 QuicConnectionIdLength connection_id_length_;
381 289
382 // Frames to be added to the next SerializedPacket 290 // Frames to be added to the next SerializedPacket
383 QuicFrames queued_frames_; 291 QuicFrames queued_frames_;
384 292
385 // packet_size should never be read directly, use PacketSize() instead. 293 // packet_size should never be read directly, use PacketSize() instead.
386 // TODO(ianswett): Move packet_size_ into SerializedPacket once 294 // TODO(ianswett): Move packet_size_ into SerializedPacket once
387 // QuicEncryptedPacket has been flattened into SerializedPacket. 295 // QuicEncryptedPacket has been flattened into SerializedPacket.
388 size_t packet_size_; 296 size_t packet_size_;
389 QuicConnectionId connection_id_; 297 QuicConnectionId connection_id_;
390 298
391 // Packet used to invoke OnSerializedPacket. 299 // Packet used to invoke OnSerializedPacket.
392 SerializedPacket packet_; 300 SerializedPacket packet_;
393 301
394 // Map mapping path_id to last sent packet number on the path. 302 // Map mapping path_id to last sent packet number on the path.
395 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_; 303 std::unordered_map<QuicPathId, QuicPacketNumber> multipath_packet_number_;
396 304
397 // FEC related fields.
398 // True when creator is requested to turn on FEC protection. False otherwise.
399 // There is a time difference between should_fec_protect_next_packet_ is
400 // true/false and FEC is actually turned on/off (e.g., The creator may have an
401 // open FEC group even if this variable is false).
402 bool should_fec_protect_next_packet_;
403 // If true, any created packets will be FEC protected.
404 // TODO(fayang): Combine should_fec_protect_next_packet and fec_protect_ to
405 // one variable.
406 bool fec_protect_;
407 scoped_ptr<QuicFecGroup> fec_group_;
408 // 0 indicates FEC is disabled.
409 size_t max_packets_per_fec_group_;
410 // FEC policy that specifies when to send FEC packet.
411 FecSendPolicy fec_send_policy_;
412 // Timeout used for FEC alarm. Can be set to zero initially or if the SRTT has
413 // not yet been set.
414 QuicTime::Delta fec_timeout_;
415 // The multiplication factor for FEC timeout based on RTT.
416 // TODO(rtenneti): Delete this code after the 0.25 RTT FEC experiment.
417 float rtt_multiplier_for_fec_timeout_;
418
419 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); 305 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator);
420 }; 306 };
421 307
422 } // namespace net 308 } // namespace net
423 309
424 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ 310 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_
OLDNEW
« no previous file with comments | « net/quic/quic_headers_stream_test.cc ('k') | net/quic/quic_packet_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698