Skip to content
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ await Http2LoopbackServer.CreateClientAndServerAsync(
}

// Let connection live until server finishes.
await serverFinished.Task.TimeoutAfter(pingTimeout * 2);
await Task.WhenAny(serverFinished.Task, Task.Delay(pingTimeout * 3));
},
async server =>
{
Expand Down Expand Up @@ -1534,7 +1534,10 @@ await Http2LoopbackServer.CreateClientAndServerAsync(
{
ping = await connection.ReadPingAsync(pingTimeout);
}
await Task.Delay(pongDelay);
if (pongDelay > TimeSpan.Zero)
{
await Task.Delay(pongDelay);
}

await connection.SendPingAckAsync(ping.Data);
}
Expand All @@ -1555,6 +1558,16 @@ await Http2LoopbackServer.CreateClientAndServerAsync(
}
else
{
// If the pings were recently coming, just give the connection time to clear up streams
// and still accept one stray ping.
if (expectStreamPing)
{
try
{
await connection.ReadPingAsync(pingTimeout);
}
catch (OperationCanceledException) { } // if it failed once, it will fail again
}
await Assert.ThrowsAsync<OperationCanceledException>(() => connection.ReadPingAsync(pingTimeout));
}
serverFinished.SetResult();
Expand Down