diff options
author | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-03 07:47:41 +0000 |
---|---|---|
committer | rch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-03 07:47:41 +0000 |
commit | fee17f78c16789e740b050327e67abe76b500884 (patch) | |
tree | e6697c04381916b358fbc6759043ab28b9be56c5 /net/quic/quic_packet_creator.h | |
parent | 7016f66d683e581d805c25cbde4db1fea933b255 (diff) | |
download | chromium_src-fee17f78c16789e740b050327e67abe76b500884.zip chromium_src-fee17f78c16789e740b050327e67abe76b500884.tar.gz chromium_src-fee17f78c16789e740b050327e67abe76b500884.tar.bz2 |
Land recent QUIC changes.
Count the number of retransmissions for a packet due to RTO and explicit nacks and implement exponential backoff based on number of retransmissions.
Merge internal change: 41823946
QuicConnection now packetizes acks and congestion control frames even more lazily and packs control frames with up to 1 stream frame.
Merge internal change: 41805161
Remove nitty-gritties of QuicFramer from QuicTimeWaitListManager and remove some static methods from QuicFramer.
Merge internal change: 41795314
Store socket addresses in QuicConnection.h instead of pushing it down to QuicFramer.h and getting it back from there.
Merge internal change: 41768211
Retransmit largest_observed_ packet if its missing.
Merge internal change: 41743584
Split framer packet creation into size determination and packet creation methods in order to ensure the maximum number of frames are fit into a single packet.
Merge internal change: 41702016
Handle packet reordering for queued packets.
Merge internal change: 41701179
Bug fix for retransmission order.
Merge internal change: 41638847
Adding basic dispatcher stats for QUIC
Merge internal change: 41630921
Minor fixes in quic_connection.cc
Merge internal change: 41610652
Use priority queue to maintain the list of sequence numbers to be retransmitted. This will enable us to do an exponential backoff for lost packets.
Merge internal change: 41582526
Adding DISALLOW_COPY_AND_ASSIGN to all congestion control classes that were missing it. And a few nits.
Merge internal change: 41580553
Break circular dependency between quic_protocol.h and quic_bandwidth.h
Merge internal change: 41578776
Fix uninitialized memory access in quic_framer_test.
Merge internal change: 41558816
Cleanup, consolidated quic_send_scheduler with quic_congestion_manager
Merge internal change: 41549823
Set the retransmit alarm only when we successfully write the packet to the socket instead of setting it when we attempt to write.
Merge internal change: 41547192
Introduced QuicByteCount and moved TCP receive_bytes packing to QuicFramer where it belongs.
Merge internal change: 41546840
Fix a bug with how FEC groups were being created in QUIC. Now opening multiple and always closing the group.
Merge internal change: 41538221
Removing QUIC logspam
Merge internal change: 41537896
Exposing ReadPublicHeader and ReadPublicResetPacket static methods which don't take a dependency on reader_(unlike Process..() methods).
Merge internal change: 41535886
Use "test" not "testing" for test namespaces to be consistent with other QUIC code.
Merge internal change: 41534488
Fix a number of minor issues that came up in landing recent chrome changes.
Merge internal change: 41531793
Removed the QuicReceiptMetricsCollector and started using the ReceiveAlgorithmInterface directly in the CongestionManager. The QuicReceiptMetricsCollector did not provide any functionality.
Merge internal change: 41486246
Integrating new quic bandwidth class
Merge internal change: 41473682
R=jar@chromium.org
BUG=
Review URL: https://chromiumcodereview.appspot.com/12145002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180299 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic/quic_packet_creator.h')
-rw-r--r-- | net/quic/quic_packet_creator.h | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/net/quic/quic_packet_creator.h b/net/quic/quic_packet_creator.h index f9836f3..b5eb9b8 100644 --- a/net/quic/quic_packet_creator.h +++ b/net/quic/quic_packet_creator.h @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Some helpers for quic packet creation. +// Accumulates frames for the next packet until more frames no longer fit or +// it's time to create a packet from them. Also provides packet creation of +// FEC packets based on previously created packets. #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ #define NET_QUIC_QUIC_PACKET_CREATOR_H_ @@ -20,6 +22,8 @@ namespace net { class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface { public: + typedef std::pair<QuicPacketSequenceNumber, QuicPacket*> PacketPair; + // Options for controlling how packets are created. struct Options { Options() @@ -28,7 +32,6 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface { max_packets_per_fec_group(0) { } - // TODO(alyssar, rch) max frames/packet size_t max_packet_length; bool random_reorder; // Inefficient: rewrite if used at scale. // 0 indicates fec is disabled. @@ -43,32 +46,41 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface { virtual void OnBuiltFecProtectedPayload(const QuicPacketHeader& header, base::StringPiece payload) OVERRIDE; - typedef std::pair<QuicPacketSequenceNumber, QuicPacket*> PacketPair; - // Checks if it's time to send an FEC packet. |force_close| forces this to // return true if an fec group is open. bool ShouldSendFec(bool force_close) const; - // Starts a new FEC group with the next serialized packet, if FEC is enabled. + // Starts a new FEC group with the next serialized packet, if FEC is enabled + // and there is not already an FEC group open. void MaybeStartFEC(); - // Converts a raw payload to a frame. Returns the number of bytes consumed - // from data. If data is empty and fin is true, the expected behavior is to - // consume the fin but return 0. + // Converts a raw payload to a frame which fits into the currently open + // packet if there is one. Returns the number of bytes consumed from data. + // If data is empty and fin is true, the expected behavior is to consume the + // fin but return 0. size_t CreateStreamFrame(QuicStreamId id, base::StringPiece data, QuicStreamOffset offset, bool fin, - QuicFrames* frames); + QuicFrame* frame); // Serializes all frames into a single packet. All frames must fit into a // single packet. PacketPair SerializeAllFrames(const QuicFrames& frames); - // Serializes as many non-fec frames as can fit into a single packet. - // num_serialized is set to the number of frames serialized into the packet. - PacketPair SerializeFrames(const QuicFrames& frames, - size_t* num_serialized); + // Returns true if there are frames pending to be serialized. + bool HasPendingFrames(); + + // Returns the number of bytes which are free to frames in the current packet. + size_t BytesFree(); + + // Adds |frame| to the packet creator's list of frames to be serialized. + // Returns false if the frame doesn't fit into the current packet. + bool AddFrame(const QuicFrame& frame); + + // Serializes all frames which have been added and adds any which should be + // retransmitted to |retransmittable_frames| if it's not NULL. + PacketPair SerializePacket(QuicFrames* retransmittable_frames); // Packetize FEC data. PacketPair SerializeFec(); @@ -90,6 +102,8 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface { } private: + static bool ShouldRetransmit(const QuicFrame& frame); + void FillPacketHeader(QuicFecGroupNumber fec_group, QuicPacketPrivateFlags flags, QuicPacketHeader* header); @@ -100,7 +114,8 @@ class NET_EXPORT_PRIVATE QuicPacketCreator : public QuicFecBuilderInterface { QuicPacketSequenceNumber sequence_number_; QuicFecGroupNumber fec_group_number_; scoped_ptr<QuicFecGroup> fec_group_; - + size_t packet_size_; + QuicFrames queued_frames_; }; } // namespace net |