Add QuicStreamsBlockedFrame and QuicMaxStreamsFrame classes
There are two main parts to this work
1) connecting up the new frames, replacing the old ones, to move data around the
system. This also entails a lot of editorial changes (just changing names, comments,
and so on, without notable logic chanages -- eg, "OnMaxStreamIdFrame" becomes
"OnMaxStreamsFrame".
2) the second, and more complex, task is revising the stream id manager to work entirely
with stream counts rather than stream-ids. For example, the logic to check whether a
new stream can be created checks if the current-stream-count is less than the limit
or not, rather than if the next stream id to hand out is above the limit or not.
For all intents and purposes, this completely rewrote the stream ID manager.
Another big change resulting from keeping track solely of stream counts is that the
stream ID manager doesn't care whether it is doing unidirectional or bidirectional
streams, nor does it care whether stream ids are client- or server- initiated.
gfe-relnote: N/A, all changes are for V99/IETF QUIC code only.
LOG_STORAGE_INCREASE(GB/week): 0
TMPLOG_STORAGE_INCREASE(GB): 0
This change neither adds nor deletes data stored. It adds two new codepoints to the QUIC FrameType enum. These new enums reflect two new frames defined in IETF QUIC, which replace two now-deprecated frames (and their associated type codepoints). This is a name change/type codepoint extension; data is neither added nor deleted.
PiperOrigin-RevId: 244661277
Change-Id: I07cdb79db6bd15e1d5ece97b3aa2d67e94ccf00b
diff --git a/quic/core/uber_quic_stream_id_manager.h b/quic/core/uber_quic_stream_id_manager.h
index bf5a588..41fa12b 100644
--- a/quic/core/uber_quic_stream_id_manager.h
+++ b/quic/core/uber_quic_stream_id_manager.h
@@ -11,6 +11,7 @@
namespace test {
class QuicSessionPeer;
+class UberQuicStreamIdManagerPeer;
} // namespace test
class QuicSession;
@@ -20,18 +21,30 @@
class QUIC_EXPORT_PRIVATE UberQuicStreamIdManager {
public:
UberQuicStreamIdManager(QuicSession* session,
- size_t max_open_outgoing_streams,
- size_t max_open_incoming_streams);
+ QuicStreamCount max_open_outgoing_streams,
+ QuicStreamCount max_open_incoming_streams);
// Called when a stream with |stream_id| is registered as a static stream.
void RegisterStaticStream(QuicStreamId id);
- // Initialize the maximum allowed outgoing stream id, number of streams, and
- // MAX_STREAM_ID advertisement window.
- void SetMaxOpenOutgoingStreams(size_t max_streams);
+ // Sets the maximum outgoing stream count as a result of doing the transport
+ // configuration negotiation. Forces the limit to max_streams, regardless of
+ // static streams.
+ void ConfigureMaxOpenOutgoingStreams(size_t max_streams);
- // Initialize the maximum allowed incoming stream id and number of streams.
- void SetMaxOpenIncomingStreams(size_t max_streams);
+ // Sets the limits to max_open_streams + number of static streams
+ // in existence. SetMaxOpenOutgoingStreams will QUIC_BUG if it is called
+ // after getting the first MAX_STREAMS frame.
+ // TODO(fkastenholz): SetMax is cognizant of the number of static streams and
+ // sets the maximum to be max_streams + number_of_statics. This should
+ // eventually be removed from IETF QUIC.
+ void SetMaxOpenOutgoingStreams(size_t max_open_streams);
+ void SetMaxOpenIncomingStreams(size_t max_open_streams);
+
+ // Sets the outgoing stream count to the number of static streams + max
+ // outgoing streams. Unlike SetMaxOpenOutgoingStreams, this method will
+ // not QUIC_BUG if called after getting the first MAX_STREAMS frame.
+ void AdjustMaxOpenOutgoingStreams(size_t max_streams);
// Returns true if next outgoing bidirectional stream ID can be allocated.
bool CanOpenNextOutgoingBidirectionalStream();
@@ -51,11 +64,11 @@
// Called when |id| is released.
void OnStreamClosed(QuicStreamId id);
- // Called when a MAX_STREAM_ID frame is received.
- bool OnMaxStreamIdFrame(const QuicMaxStreamIdFrame& frame);
+ // Called when a MAX_STREAMS frame is received.
+ bool OnMaxStreamsFrame(const QuicMaxStreamsFrame& frame);
- // Called when a STREAM_ID_BLOCKED frame is received.
- bool OnStreamIdBlockedFrame(const QuicStreamIdBlockedFrame& frame);
+ // Called when a STREAMS_BLOCKED frame is received.
+ bool OnStreamsBlockedFrame(const QuicStreamsBlockedFrame& frame);
// Return true if |id| is peer initiated.
bool IsIncomingStream(QuicStreamId id) const;
@@ -73,20 +86,19 @@
QuicStreamId next_outgoing_bidirectional_stream_id() const;
QuicStreamId next_outgoing_unidirectional_stream_id() const;
- QuicStreamId max_allowed_outgoing_bidirectional_stream_id() const;
- QuicStreamId max_allowed_outgoing_unidirectional_stream_id() const;
-
size_t max_allowed_outgoing_bidirectional_streams() const;
size_t max_allowed_outgoing_unidirectional_streams() const;
- QuicStreamId actual_max_allowed_incoming_bidirectional_stream_id() const;
- QuicStreamId actual_max_allowed_incoming_unidirectional_stream_id() const;
+ QuicStreamCount actual_max_allowed_incoming_bidirectional_streams() const;
+ QuicStreamCount actual_max_allowed_incoming_unidirectional_streams() const;
- QuicStreamId advertised_max_allowed_incoming_bidirectional_stream_id() const;
- QuicStreamId advertised_max_allowed_incoming_unidirectional_stream_id() const;
+ QuicStreamCount advertised_max_allowed_incoming_bidirectional_streams() const;
+ QuicStreamCount advertised_max_allowed_incoming_unidirectional_streams()
+ const;
private:
friend class test::QuicSessionPeer;
+ friend class test::UberQuicStreamIdManagerPeer;
// Manages stream IDs of bidirectional streams.
QuicStreamIdManager bidirectional_stream_id_manager_;