Landing Recent QUIC changes since Sat Jan 16 03:19:36 2016 +0000
Change QuicPacketGenerator and QuicPacketCreator to accept a PendingRetransmission. No functional change.
Merge internal change: 112304391
https://codereview.chromium.org/1611313004/
Change the toy server to return a 404 error code instead of 500 when the URL is not found in the cache.
n/a QUIC toy server only
Merge internal change: 112280143
https://codereview.chromium.org/1619003002/
Populate loss events in TransportConnectionStats. No behavior change.
Record loss events for packet loss and time out retransmissions in
QuicTransportConnectionStatsVisitor::OnPacketSend()
Merge internal change: 112280034
https://codereview.chromium.org/1615163002/
Adds tests to QUIC's PacingSender to verify that all SendAlgorithmInterface calls are plumbed through to the inner send_algorithm.
Merge internal change: 112271996
https://codereview.chromium.org/1611293005/
Fix QUIC pacing sender to actually call internal send_algorithm on OnConnectionMigration().
Merge internal change: 112215200
https://codereview.chromium.org/1611393002/
Reorder the fields of QuicPacketCreator. No functional change.
Slightly easier to read and allows replacement of many fields with a
single SerializedPacket field in a future CL.
Merge internal change: 112173487
https://codereview.chromium.org/1614183002/
Migrating all quic DFATALs to QUIC_BUG and QUIC_BUG_IF
Also adding QUIC_BUG_IF and GFE_BUG_IF since otherwise migration results
in uglier code.
Merge internal change: 112146776
https://codereview.chromium.org/1612173002/
Add include_path_id to QuicPacket, packet size and stream offset calculation functions. Add send_path_id_in_packet_ to QuicPacketCreator.
send_path_id_in_packet_ is set to true when current_path_ is not the
default path. Before multipath is negotiated, all packets, with
multipath flag on, causes a connection close with error
QUIC_BAD_MULTIPATH_FLAG.
Merge internal change: 112080410
https://codereview.chromium.org/1614713003/
Use shared QuicPacketWriter for QuicTimeWaitListManager. No functional change. Guarded by FLAGS_quic_time_wait_list_manager_use_shared_writer.
Merge internal change: 112057565
https://codereview.chromium.org/1615853003/
Change QUIC's TransmissionInfo to no longer use RetransmittableFrames. No functional change.
A future CL will remove RetransmittableFrames from the rest of the QUIC
code.
Merge internal change: 112005148
https://codereview.chromium.org/1615073004/
Rename QuickAckFrame.delta_time_largest_observed to ack_delay_time. No functional change.
Merge internal change: 111965141
https://codereview.chromium.org/1618933002/
Make QuicClient be able to have multiple UDP sockets and hence multiple client addresses.
Currently, only the latest created and registered UDP socket is in
use. This change is the first step to allow QuicClient to create new
path.
Merge internal change: 111964324
https://codereview.chromium.org/1616133002/
Change QuicPathCloseFrame from inline to pointer and re-land adding PATH_CLOSE_FRAME changelist 111727880.
Merge internal change: 111949428
https://codereview.chromium.org/1619703007/
Rename QuicConnectionHelper to QuicEpollConnectionHelper.
Merge internal change: 111895927
[No merge needed]
Review URL: https://codereview.chromium.org/1615643003
Cr-Commit-Position: refs/heads/master@{#371028}
diff --git a/net/quic/quic_protocol.h b/net/quic/quic_protocol.h
index 2921403..018a6064 100644
--- a/net/quic/quic_protocol.h
+++ b/net/quic/quic_protocol.h
@@ -257,6 +257,7 @@
BLOCKED_FRAME = 5,
STOP_WAITING_FRAME = 6,
PING_FRAME = 7,
+ PATH_CLOSE_FRAME = 8,
// STREAM and ACK frames are special frames. They are encoded differently on
// the wire and their values do not need to be stable.
@@ -431,11 +432,14 @@
NET_EXPORT_PRIVATE size_t
GetStartOfFecProtectedData(QuicConnectionIdLength connection_id_length,
bool include_version,
+ bool include_path_id,
QuicPacketNumberLength packet_number_length);
+
// Index of the first byte in a QUIC packet of encrypted data.
NET_EXPORT_PRIVATE size_t
GetStartOfEncryptedData(QuicConnectionIdLength connection_id_length,
bool include_version,
+ bool include_path_id,
QuicPacketNumberLength packet_number_length);
enum QuicRstStreamErrorCode {
@@ -477,7 +481,7 @@
// These values must remain stable as they are uploaded to UMA histograms.
// To add a new error code, use the current value of QUIC_LAST_ERROR and
// increment QUIC_LAST_ERROR.
-// last value = 78
+// last value = 80
enum QuicErrorCode {
QUIC_NO_ERROR = 0,
@@ -511,6 +515,8 @@
QUIC_INVALID_BLOCKED_DATA = 58,
// STOP_WAITING frame data is malformed.
QUIC_INVALID_STOP_WAITING_DATA = 60,
+ // PATH_CLOSE frame data is malformed.
+ QUIC_INVALID_PATH_CLOSE_DATA = 78,
// ACK frame data is malformed.
QUIC_INVALID_ACK_DATA = 9,
@@ -639,20 +645,23 @@
// tampered with.
QUIC_VERSION_NEGOTIATION_MISMATCH = 55,
+ // Multipath is not enabled, but a packet with multipath flag on is received.
+ QUIC_BAD_MULTIPATH_FLAG = 79,
+
// IP address changed causing connection close.
- QUIC_IP_ADDRESS_CHANGED = 78,
+ QUIC_IP_ADDRESS_CHANGED = 80,
// Connection migration errors.
// Network changed, but connection had no migratable streams.
- QUIC_CONNECTION_MIGRATION_NO_MIGRATABLE_STREAMS = 79,
+ QUIC_CONNECTION_MIGRATION_NO_MIGRATABLE_STREAMS = 81,
// Connection changed networks too many times.
- QUIC_CONNECTION_MIGRATION_TOO_MANY_CHANGES = 80,
+ QUIC_CONNECTION_MIGRATION_TOO_MANY_CHANGES = 82,
// Connection migration was attempted, but there was no new network to
// migrate to.
- QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK = 81,
+ QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK = 83,
// No error. Used as bound while iterating.
- QUIC_LAST_ERROR = 82,
+ QUIC_LAST_ERROR = 84,
};
// Must be updated any time a QuicErrorCode is deprecated.
@@ -949,7 +958,7 @@
// Time elapsed since largest_observed was received until this Ack frame was
// sent.
- QuicTime::Delta delta_time_largest_observed;
+ QuicTime::Delta ack_delay_time;
// Vector of <packet_number, time> for when packets arrived.
PacketTimeVector received_packet_times;
@@ -1068,6 +1077,23 @@
QuicStreamId stream_id;
};
+// The PATH_CLOSE frame is used to explicitly close a path. Both endpoints can
+// send a PATH_CLOSE frame to initiate a path termination. A path is considered
+// to be closed either a PATH_CLOSE frame is sent or received. An endpoint drops
+// receive side of a closed path, and packets with retransmittable frames on a
+// closed path are marked as retransmissions which will be transmitted on other
+// paths.
+struct NET_EXPORT_PRIVATE QuicPathCloseFrame {
+ QuicPathCloseFrame() {}
+ explicit QuicPathCloseFrame(QuicPathId path_id);
+
+ NET_EXPORT_PRIVATE friend std::ostream& operator<<(
+ std::ostream& os,
+ const QuicPathCloseFrame& p);
+
+ QuicPathId path_id;
+};
+
// EncryptionLevel enumerates the stages of encryption that a QUIC connection
// progresses through. When retransmitting a packet, the encryption level needs
// to be specified so that it is retransmitted at a level which the peer can
@@ -1111,6 +1137,7 @@
explicit QuicFrame(QuicGoAwayFrame* frame);
explicit QuicFrame(QuicWindowUpdateFrame* frame);
explicit QuicFrame(QuicBlockedFrame* frame);
+ explicit QuicFrame(QuicPathCloseFrame* frame);
NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
const QuicFrame& frame);
@@ -1131,6 +1158,7 @@
QuicGoAwayFrame* goaway_frame;
QuicWindowUpdateFrame* window_update_frame;
QuicBlockedFrame* blocked_frame;
+ QuicPathCloseFrame* path_close_frame;
};
};
// QuicFrameType consumes 8 bytes with padding.
@@ -1163,11 +1191,15 @@
class NET_EXPORT_PRIVATE QuicPacket : public QuicData {
public:
+ // TODO(fayang): 4 fields from public header are passed in as arguments.
+ // Consider to add a convenience method which directly accepts the entire
+ // public header.
QuicPacket(char* buffer,
size_t length,
bool owns_buffer,
QuicConnectionIdLength connection_id_length,
bool includes_version,
+ bool includes_path_id,
QuicPacketNumberLength packet_number_length);
base::StringPiece FecProtectedData() const;
@@ -1180,6 +1212,7 @@
char* buffer_;
const QuicConnectionIdLength connection_id_length_;
const bool includes_version_;
+ const bool includes_path_id_;
const QuicPacketNumberLength packet_number_length_;
DISALLOW_COPY_AND_ASSIGN(QuicPacket);
@@ -1214,6 +1247,8 @@
const QuicFrame& AddFrame(const QuicFrame& frame);
// Removes all stream frames associated with |stream_id|.
void RemoveFramesForStream(QuicStreamId stream_id);
+ // Swaps the frames from RetransmittableFrames into |destination_frames|.
+ void SwapFrames(QuicFrames* destination_frames);
const QuicFrames& frames() const { return frames_; }
@@ -1283,19 +1318,20 @@
// Used by STL when assigning into a map.
TransmissionInfo();
- // Constructs a Transmission with a new all_tranmissions set
+ // Constructs a Transmission with a new all_transmissions set
// containing |packet_number|.
- TransmissionInfo(RetransmittableFrames* retransmittable_frames,
- EncryptionLevel level,
+ TransmissionInfo(EncryptionLevel level,
QuicPacketNumberLength packet_number_length,
TransmissionType transmission_type,
QuicTime sent_time,
QuicPacketLength bytes_sent,
- bool is_fec_packet);
+ bool is_fec_packet,
+ bool has_crypto_handshake,
+ bool needs_padding);
~TransmissionInfo();
- RetransmittableFrames* retransmittable_frames;
+ QuicFrames retransmittable_frames;
EncryptionLevel encryption_level;
QuicPacketNumberLength packet_number_length;
QuicPacketLength bytes_sent;
@@ -1309,6 +1345,10 @@
bool is_unackable;
// True if the packet is an FEC packet.
bool is_fec_packet;
+ // True if the packet contains stream data from the crypto stream.
+ bool has_crypto_handshake;
+ // True if the packet needs padding if it's retransmitted.
+ bool needs_padding;
// Stores the packet numbers of all transmissions of this packet.
// Must always be nullptr or have multiple elements.
// TODO(ianswett): Deprecate with quic_track_single_retransmission.
@@ -1322,6 +1362,35 @@
static_assert(sizeof(QuicFrame) <= 64,
"Keep the TransmissionInfo size to a cacheline.");
+// Struct to store the pending retransmission information.
+struct PendingRetransmission {
+ PendingRetransmission(QuicPathId path_id,
+ QuicPacketNumber packet_number,
+ TransmissionType transmission_type,
+ const QuicFrames& retransmittable_frames,
+ bool has_crypto_handshake,
+ bool needs_padding,
+ EncryptionLevel encryption_level,
+ QuicPacketNumberLength packet_number_length)
+ : path_id(path_id),
+ packet_number(packet_number),
+ transmission_type(transmission_type),
+ retransmittable_frames(retransmittable_frames),
+ has_crypto_handshake(has_crypto_handshake),
+ needs_padding(needs_padding),
+ encryption_level(encryption_level),
+ packet_number_length(packet_number_length) {}
+
+ QuicPathId path_id;
+ QuicPacketNumber packet_number;
+ TransmissionType transmission_type;
+ const QuicFrames& retransmittable_frames;
+ bool has_crypto_handshake;
+ bool needs_padding;
+ EncryptionLevel encryption_level;
+ QuicPacketNumberLength packet_number_length;
+};
+
// Convenience wrapper to wrap an iovec array and the total length, which must
// be less than or equal to the actual total length of the iovecs.
struct NET_EXPORT_PRIVATE QuicIOVector {