Landing Recent QUIC changes until 06/21/2015

relnote: Implement sending path MTU discovery probe packets in QUIC.
This code is not currently invoked, so no feature flags are included.

This change introduces a new kind of packet, MTU_DISCOVERY_PACKET, which
is serialized on wire as a ping packet, but unlike ping packets, MTU
discovery packets are not retransmittable.

The key method introduced here is SendMtuPacket.  It sets the specified
MTU value, sends a padded MTU_DISCOVERY_PACKET packet (which is
represented as PING_FRAME followed by PADDING_FRAME on wire), and then
resets the method back.

There is no wire format change, hence no version change is required.

Merge internal change: 96424827
https://codereview.chromium.org/1211873005/

QUIC - Added missing override.

relnote: Minor change to keep the code similar to chromium.

Merge internal change: 96413770
https://codereview.chromium.org/1208353002/

relnote: Adding ...QuicClientSession (including refactors to existing code).

The new session class is not used in production.  the refactors to
production code should be no-ops but you never know...

Merge internal change: 96399929
https://codereview.chromium.org/1215523003/

relnote:  Don't count draining QUIC streams against the maximum stream
count for a connection.

FIXED=21781355

Merge internal change: 96339912
https://codereview.chromium.org/1212183002/

relnote:  Check that the write side is not already closed in
ReliableQuicStream::WriteOrBufferData.  No behavior change expected.

Add further check to ReliableQuicStream::WriteOrBufferData.
Expand and clarify comments for ReliableQuicStream.

Merge internal change: 96333968
https://codereview.chromium.org/1209183002/

relnote: Remove the max CWND constant.  One removal is flag protected by
FLAGS_quic_use_is_useless_packet.

Instead bases the maximum number of outstanding QUIC packets on the
client's receive window size instead of a fixed value of 1000.

Merge internal change: 96330128
https://codereview.chromium.org/1208163004/

relnote: Bring back QuicStreamSequencer::MarkConsumed

This is effectively a rollback of cr/63098466 which landed 15 months ago.

Merge internal change: 96317855ap
https://codereview.chromium.org/1210183004/

relnote: Introduce support for non-retransmittable packets into AckNotifier
interface.  No functional change.

Previously, only retransmittable packets could be handled using
AckNotifier interface.  This changelist introduces support for
non-retransmittable packets, which mostly involves removing the packets
from the listener map in case they are lost (which is not an issue for
retransmittable packets, which are retransmitted until acknowledged or
until the connection is terminated).

The intended consumer of this feature is path MTU discovery code,
which would use it to increase the packet size when larger path MTU is
discovered.

This change also introduces unit tests for AckNotifierManager, primarily
to verify that the class behaves as expected with respect to packet
retransmission and abandonment logic.

Merge internal change: 96267352
https://codereview.chromium.org/1214483004/

[email protected]

Review URL: https://codereview.chromium.org/1213443004

Cr-Commit-Position: refs/heads/master@{#336335}
diff --git a/net/quic/quic_protocol.h b/net/quic/quic_protocol.h
index f7437a1..8c23d1a0 100644
--- a/net/quic/quic_protocol.h
+++ b/net/quic/quic_protocol.h
@@ -74,8 +74,11 @@
 // Minimum size of the CWND, in packets, when doing bandwidth resumption.
 const QuicPacketCount kMinCongestionWindowForBandwidthResumption = 10;
 
-// Maximum size of the CWND, in packets, for TCP congestion control algorithms.
-const QuicPacketCount kMaxTcpCongestionWindow = 200;
+// Maximum size of the CWND, in packets, for bandwidth resumption.
+const QuicPacketCount kMaxResumptionCwnd = 200;
+
+// Maximum number of tracked packets.
+const QuicPacketCount kMaxTrackedPackets = 5000;
 
 // Default size of the socket receive buffer in bytes.
 const QuicByteCount kDefaultSocketReceiveBuffer = 256 * 1024;
@@ -237,6 +240,8 @@
   // the wire and their values do not need to be stable.
   STREAM_FRAME,
   ACK_FRAME,
+  // The path MTU discovery frame is encoded as a PING frame on the wire.
+  MTU_DISCOVERY_FRAME,
   NUM_FRAME_TYPES
 };
 
@@ -669,6 +674,10 @@
 struct NET_EXPORT_PRIVATE QuicPingFrame {
 };
 
+// A path MTU discovery frame contains no payload and is serialized as a ping
+// frame.
+struct NET_EXPORT_PRIVATE QuicMtuDiscoveryFrame {};
+
 struct NET_EXPORT_PRIVATE QuicStreamFrame {
   QuicStreamFrame();
   QuicStreamFrame(const QuicStreamFrame& frame);
@@ -877,6 +886,7 @@
   explicit QuicFrame(QuicPaddingFrame* padding_frame);
   explicit QuicFrame(QuicStreamFrame* stream_frame);
   explicit QuicFrame(QuicAckFrame* frame);
+  explicit QuicFrame(QuicMtuDiscoveryFrame* frame);
 
   explicit QuicFrame(QuicRstStreamFrame* frame);
   explicit QuicFrame(QuicConnectionCloseFrame* frame);
@@ -894,6 +904,7 @@
     QuicPaddingFrame* padding_frame;
     QuicStreamFrame* stream_frame;
     QuicAckFrame* ack_frame;
+    QuicMtuDiscoveryFrame* mtu_discovery_frame;
 
     QuicStopWaitingFrame* stop_waiting_frame;