diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs index 26058a454a9e1..11d4d9ce5bb9a 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Connection.cs @@ -1697,7 +1697,7 @@ public override long GetIdleTicks(long nowTicks) { lock (SyncObject) { - return _streamsInUse == 0 ? _idleSinceTickCount - nowTicks : 0; + return _streamsInUse == 0 ? nowTicks - _idleSinceTickCount : 0; } } diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs index b326c8bbb0214..b5988fafed303 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs @@ -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; @@ -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);