Skip to content

[QUIC] Decide how to handle QUIC stream limits #32079

@scalablecory

Description

@scalablecory

How should we be validating these limits?

/// <summary>
/// Limit on the number of bidirectional streams the peer connection can create
/// on an accepted connection.
/// Default is 100.
/// </summary>
// TODO consider constraining these limits to 0 to whatever the max of the QUIC library we are using.
public long MaxBidirectionalStreams { get; set; } = 100;
/// <summary>
/// Limit on the number of unidirectional streams the peer connection can create
/// on an accepted connection.
/// Default is 100.
/// </summary>
// TODO consider constraining these limits to 0 to whatever the max of the QUIC library we are using.
public long MaxUnidirectionalStreams { get; set; } = 100;

How do we get notified that a connection's stream limit has changed(MAX_STREAMS frame event)? This is required for HTTP/3

/// <summary>
/// Gets the maximum number of bidirectional streams that can be made to the peer.
/// </summary>
public long GetRemoteAvailableUnidirectionalStreamCount() => _provider.GetRemoteAvailableUnidirectionalStreamCount();
/// <summary>
/// Gets the maximum number of unidirectional streams that can be made to the peer.
/// </summary>
public long GetRemoteAvailableBidirectionalStreamCount() => _provider.GetRemoteAvailableBidirectionalStreamCount();

// TODO: how do we get this event?
private void OnMaximumStreamCountIncrease(long newMaximumStreamCount)
{
lock (SyncObj)
{
if (newMaximumStreamCount <= _maximumRequestStreams)
{
return;
}
_requestStreamsRemaining += (newMaximumStreamCount - _maximumRequestStreams);
_maximumRequestStreams = newMaximumStreamCount;
while (_requestStreamsRemaining != 0 && _waitingRequests.TryDequeue(out TaskCompletionSourceWithCancellation<bool> tcs))
{
if (tcs.TrySetResult(true))
{
--_requestStreamsRemaining;
}
}
}
}

Metadata

Metadata

Assignees

Labels

area-System.Net.QuicenhancementProduct code improvement that does NOT require public API changes/additions

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions