Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement dynamic HTTP/2 window scaling#54755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
antonfirsov merged 40 commits intodotnet:mainfromantonfirsov:http/dynamic-window-02
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
40 commits
Select commitHold shift + click to select a range
1d41853
Implement dynamic HTTP2 window scaling
antonfirsovJun 25, 2021
4067443
Merge branch 'main' into http/dynamic-window-02
antonfirsovJun 25, 2021
a3800d3
actually fix the conflict with #54437
antonfirsovJun 25, 2021
9f50764
add comment on PING payloads
antonfirsovJun 25, 2021
3c7c474
delete StringBuilderOutput
antonfirsovJun 25, 2021
6eb66e9
DisableDynamicWindowSizing: fix name
antonfirsovJun 25, 2021
4c7f3ac
make RttEstimator.MinRtt thread-safe
antonfirsovJun 26, 2021
473139d
simplify RuntimeSettingParserTest code
antonfirsovJun 28, 2021
f2ff4ee
respond to PING while reading CONTINUATION frames in ProcessHeadersFrame
antonfirsovJun 28, 2021
2bf13e0
fix test
antonfirsovJun 28, 2021
526d723
add PingBeforeContinuationFrame_Success
antonfirsovJun 28, 2021
7362e87
WIP: SetupAutomaticPingResponse by default
antonfirsovJun 30, 2021
4dfcfeb
WIP: SetupAutomaticPingResponse by default
antonfirsovJun 30, 2021
6e9142b
fix Http2_PingKeepAlive formatting
antonfirsovJun 30, 2021
e30ab75
delete manual ping response setup code
antonfirsovJun 30, 2021
20416ac
disallow PING frames before CONTINUATION again
antonfirsovJun 30, 2021
9f53e0a
move process-wide settings to GlobalHttpSettings & remove MaximumWind…
antonfirsovJun 30, 2021
13d2066
cleanup defaults
antonfirsovJun 30, 2021
e6cc7c3
nits
antonfirsovJun 30, 2021
b89e4bc
reduce footprint of Http2StreamWindowManager & RttEstimator
antonfirsovJun 30, 2021
1df65a2
comments
antonfirsovJun 30, 2021
3e18b0b
allow receiving PING ACK after GOAWAY
antonfirsovJun 30, 2021
fb3b90e
Merge branch 'main' into http/dynamic-window-02
antonfirsovJun 30, 2021
a54dfdc
nit
antonfirsovJun 30, 2021
dd8d2cc
defer _lastWindowUpdate = Stopwatch.GetTimestamp()
antonfirsovJun 30, 2021
4f302c7
delete extra newlines
antonfirsovJun 30, 2021
e4d8639
remove _respondToPing
antonfirsovJun 30, 2021
c7761e2
Http2LoopbackConnection: allow PING ACK after GOAWAY
antonfirsovJun 30, 2021
e23cac8
EnableTransparentPingResponse = false in Http2_PingKeepAlive
antonfirsovJun 30, 2021
70a04c3
commit suggestion
antonfirsovJun 30, 2021
ddd6ea1
Merge branch 'main' into http/dynamic-window-02
antonfirsovJul 1, 2021
7b006a5
sync DiagnosticsHandler with #54437
antonfirsovJul 1, 2021
bc2b9b5
fix build
antonfirsovJul 1, 2021
95f9e0d
Apply suggestions
antonfirsovJul 2, 2021
aba1735
separate _expectPingFrame and _transparentPingResponse functionality
antonfirsovJul 2, 2021
5cbf0e1
check for _streamWindowSize < MaxStreamWindowSize before trying to ex…
antonfirsovJul 2, 2021
cd94dcf
nit
antonfirsovJul 5, 2021
6954f61
move DefaultInitialHttp2StreamWindowSize
antonfirsovJul 5, 2021
6dbfa47
harden LowBandwidthDelayProduct_ClientStreamReceiveWindowStopsScaling
antonfirsovJul 5, 2021
3009773
delete unreliable LowBandwidthDelayProduct_ClientStreamReceiveWindowS…
antonfirsovJul 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
separate _expectPingFrame and _transparentPingResponse functionality
  • Loading branch information
@antonfirsov
antonfirsov committedJul 2, 2021
commitaba173540a95a920b5f1069801872eae7ac5ce43
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,11 +36,12 @@ public class Http2LoopbackConnection : GenericLoopbackConnection
public Stream Stream => _connectionStream;
public Task<bool> SettingAckWaiter => _ignoredSettingsAckPromise?.Task;

private Http2LoopbackConnection(SocketWrapper socket, Stream stream, TimeSpan timeout)
private Http2LoopbackConnection(SocketWrapper socket, Stream stream, TimeSpan timeout, bool transparentPingResponse)
{
_connectionSocket = socket;
_connectionStream = stream;
_timeout = timeout;
_transparentPingResponse = transparentPingResponse;
}

public static Task<Http2LoopbackConnection> CreateAsync(SocketWrapper socket, Stream stream, Http2Options httpOptions)
Expand DownExpand Up@@ -78,12 +79,8 @@ public static async Task<Http2LoopbackConnection> CreateAsync(SocketWrapper sock
stream = sslStream;
}

var con = new Http2LoopbackConnection(socket, stream, timeout);
var con = new Http2LoopbackConnection(socket, stream, timeout, httpOptions.EnableTransparentPingResponse);
await con.ReadPrefixAsync().ConfigureAwait(false);
if (httpOptions.EnableTransparentPingResponse)
{
con.SetuptransparentPingResponse();
}

return con;
}
Expand DownExpand Up@@ -204,20 +201,12 @@ public async Task<Frame> ReadFrameAsync(CancellationToken cancellationToken)
return await ReadFrameAsync(cancellationToken).ConfigureAwait(false);
}

if (_expectPingFrame != null &&header.Type == FrameType.Ping)
if (header.Type == FrameType.Ping && (_expectPingFrame != null || _transparentPingResponse))
{
PingFrame pingFrame = PingFrame.ReadFrom(header, data);

// _expectPingFrame is not intended to work with PING ACK:
if (!pingFrame.AckFlag)
{
await ProcessExpectedPingFrameAsync(pingFrame);
return await ReadFrameAsync(cancellationToken).ConfigureAwait(false);
}
else
{
return pingFrame;
}
bool processed = await TryProcessExpectedPingFrameAsync(pingFrame);
return processed ? await ReadFrameAsync(cancellationToken).ConfigureAwait(false) : pingFrame;
}

// Construct the correct frame type and return it.
Expand DownExpand Up@@ -246,30 +235,30 @@ public async Task<Frame> ReadFrameAsync(CancellationToken cancellationToken)
}
}

private async Task ProcessExpectedPingFrameAsync(PingFrame pingFrame)
private async Task<bool> TryProcessExpectedPingFrameAsync(PingFrame pingFrame)
{
_expectPingFrame.SetResult(pingFrame);
bool shutdownOccured = false;
if (_transparentPingResponse)
if (_expectPingFrame != null)
{
_expectPingFrame.SetResult(pingFrame);
_expectPingFrame = null;
return true;
}
else if (_transparentPingResponse && !pingFrame.AckFlag)
{
bool shutdownOccured = false;
try
{
await SendPingAckAsync(pingFrame.Data);
}
catch (IOException ex) when (_expectClientDisconnect && ex.InnerException is SocketExceptionsex &&sex.SocketErrorCode == SocketError.Shutdown)
catch (IOException ex) when (_expectClientDisconnect && ex.InnerException is SocketExceptionse &&se.SocketErrorCode == SocketError.Shutdown)
{
// couldn't send PING ACK, because client is already disconnected
shutdownOccured = true;
}
_transparentPingResponse = !shutdownOccured;
return true;
}

_expectPingFrame = null;
_transparentPingResponse = !shutdownOccured;

if (_transparentPingResponse)
{
_ = ExpectPingFrameAsync();
}
return false;
}

// Reset and return underlying networking objects.
Expand DownExpand Up@@ -306,25 +295,22 @@ public void IgnoreWindowUpdates()
_ignoreWindowUpdates = true;
}

// Set up loopback server to expect a(non-ACK)PING frame among other frames.
// Set up loopback server to expect a PING frame among other frames.
// Once PING frame is read in ReadFrameAsync, the returned task is completed.
// The returned task is canceled in ReadPingAsync if no PING frame has been read so far.
// Does not work when Http2Options.EnableTransparentPingResponse == true
public Task<PingFrame> ExpectPingFrameAsync()
{
_expectPingFrame ??= new TaskCompletionSource<PingFrame>();
if (_transparentPingResponse)
{
throw new InvalidOperationException(
$"{nameof(Http2LoopbackConnection)}.{nameof(ExpectPingFrameAsync)} can not be used when transparent PING response is enabled.");
}

_expectPingFrame ??= new TaskCompletionSource<PingFrame>();
return _expectPingFrame.Task;
}

// Recurring variant of ExpectPingFrame().
// Starting from the time of the call, respond to all (non-ACK) PING frames which are received among other frames.
private void SetuptransparentPingResponse()
{
if (_transparentPingResponse) return;
_transparentPingResponse = true;
_ = ExpectPingFrameAsync();
}

public async Task ReadRstStreamAsync(int streamId)
{
Frame frame = await ReadFrameAsync(_timeout);
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1891,7 +1891,6 @@ await Http2LoopbackServer.CreateClientAndServerAsync(
},
new Http2Options() { EnableTransparentPingResponse = false });
}

}

[OuterLoop("Uses Task.Delay")]
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp