Skip to content

Commit

Permalink
Fix Http2Connection.GetIdleTicks (#55820)
Browse files Browse the repository at this point in the history
There is currently a wrong operand order in the subtraction.

Fixes #43877
  • Loading branch information
alnikola committed Jul 16, 2021
1 parent d4dcde1 commit 04a8f5e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@ public override long GetIdleTicks(long nowTicks)
{
lock (SyncObject)
{
return _streamsInUse == 0 ? _idleSinceTickCount - nowTicks : 0;
return _streamsInUse == 0 ? nowTicks - _idleSinceTickCount : 0;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,6 @@ public async Task Http2_MultipleConnectionsEnabled_OpenAndCloseMultipleConnectio

[ConditionalFact(nameof(SupportsAlpn))]
[OuterLoop("Incurs long delay")]
[ActiveIssue("https://github.com/dotnet/runtime/issues/43877")]
public async Task Http2_MultipleConnectionsEnabled_IdleConnectionTimeoutExpired_ConnectionRemovedAndNewCreated()
{
const int MaxConcurrentStreams = 2;
Expand Down Expand Up @@ -2244,15 +2243,6 @@ public async Task Http2_MultipleConnectionsEnabled_IdleConnectionTimeoutExpired_

// Wait until the idle connection timeout expires.
await connection1.WaitForClientDisconnectAsync(false).WaitAsync(TestHelper.PassingTestTimeout).ConfigureAwait(false);
// Client connection might be still alive, so send an extra request which will either land on the shutting down connection or on a new one.
try
{
await client.GetAsync(server.Address).WaitAsync(handler.PooledConnectionIdleTimeout).ConfigureAwait(false);
}
catch (Exception)
{
// Suppress all exceptions.
}

Assert.True(connection1.IsInvalid);
Assert.False(connection0.IsInvalid);
Expand Down

0 comments on commit 04a8f5e

Please sign in to comment.