Clean up Happy Eyeballs Verbose Spam (#1224)

* Clean up HappyEyeballs verbose spam

- Cancellations should be properly suppressed now

* Bump ClientStructs
This commit is contained in:
KazWolfe 2023-05-28 22:46:49 -07:00 committed by GitHub
parent 0014bfa6fc
commit 956e310041
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 9 deletions

View file

@ -91,11 +91,7 @@ public class HappyEyeballsCallback : IDisposable
private async Task<NetworkStream> AttemptConnection(IPAddress address, int port, CancellationToken token, CancellationToken delayToken)
{
await AsyncUtils.CancellableDelay(-1, delayToken).ConfigureAwait(false);
if (token.IsCancellationRequested)
{
return Task.FromCanceled<NetworkStream>(token).Result;
}
token.ThrowIfCancellationRequested();
var socket = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
{
@ -116,9 +112,9 @@ public class HappyEyeballsCallback : IDisposable
private async Task<List<IPAddress>> GetSortedAddresses(string hostname, CancellationToken token)
{
// This method abuses DNS ordering and LINQ a bit. We can normally assume that "addresses" will be provided in
// This method abuses DNS ordering and LINQ a bit. We can normally assume that addresses will be provided in
// the order the system wants to use. GroupBy will return its groups *in the order they're discovered*. Meaning,
// the first group created will always be the "preferred" group, and all other groups are in preference order.
// the first group created will always be the preferred group, and all other groups are in preference order.
// This means a straight zipper merge is nice and clean and gives us most -> least preferred, repeating.
var dnsRecords = await Dns.GetHostAddressesAsync(hostname, this.forcedAddressFamily, token);

View file

@ -51,7 +51,7 @@ public static class AsyncUtils
{
try
{
await Task.Delay(millisecondsDelay, cancellationToken);
await Task.Delay(millisecondsDelay, cancellationToken).ConfigureAwait(false);
}
catch (TaskCanceledException)
{

@ -1 +1 @@
Subproject commit 5e9568845ac302540ce1135abbff7bef98314714
Subproject commit 8e25367e5f7d3acbe8e2b2a81121852b1ea1291c