未验证 提交 059e6bb3 编写于 作者: T Tomas Weinfurt 提交者: GitHub

attempt to stabilize CopyToAsync_AllDataCopied_Large for Tls13 (#44741)

* attempt to stabilize CopyToAsync_AllDataCopied_Large for Tls13

* feedback from review

* swap streams back

* feedback from windows

* remove extra using
上级 00417ded
......@@ -30,6 +30,20 @@ protected override async Task<StreamPair> CreateWrappedConnectedStreamsAsync(Str
ssl2.AuthenticateAsServerAsync(cert, false, GetSslProtocols(), false)
}.WhenAllOrAnyFailed().ConfigureAwait(false);
if (GetSslProtocols() == SslProtocols.Tls13)
{
// TLS 1.3 can generate some extra messages and we may get reset if test sends unidirectional traffic
// and extra packet stays in socket buffer.
// This ping-ping should flush leftovers from the handshake.
// We use sync method to preserve socket in default blocking state
// (as we don't go back once Async is used at least once)
ssl1.Write(new byte[1]);
ssl2.Write(new byte[1]);
Assert.Equal(1, ssl2.Read(new byte[1]));
Assert.Equal(1, ssl1.Read(new byte[1]));
}
return new StreamPair(ssl1, ssl2);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册