From 956e310041fe7f0456ec158373261f873865daaf Mon Sep 17 00:00:00 2001 From: KazWolfe Date: Sun, 28 May 2023 22:46:49 -0700 Subject: [PATCH] Clean up Happy Eyeballs Verbose Spam (#1224) * Clean up HappyEyeballs verbose spam - Cancellations should be properly suppressed now * Bump ClientStructs --- Dalamud/Networking/Http/HappyEyeballsCallback.cs | 10 +++------- Dalamud/Utility/AsyncUtils.cs | 2 +- lib/FFXIVClientStructs | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Dalamud/Networking/Http/HappyEyeballsCallback.cs b/Dalamud/Networking/Http/HappyEyeballsCallback.cs index af854fb2c..7ca77576c 100644 --- a/Dalamud/Networking/Http/HappyEyeballsCallback.cs +++ b/Dalamud/Networking/Http/HappyEyeballsCallback.cs @@ -91,11 +91,7 @@ public class HappyEyeballsCallback : IDisposable private async Task AttemptConnection(IPAddress address, int port, CancellationToken token, CancellationToken delayToken) { await AsyncUtils.CancellableDelay(-1, delayToken).ConfigureAwait(false); - - if (token.IsCancellationRequested) - { - return Task.FromCanceled(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> 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); diff --git a/Dalamud/Utility/AsyncUtils.cs b/Dalamud/Utility/AsyncUtils.cs index d252bd5d5..c0fbbb8a4 100644 --- a/Dalamud/Utility/AsyncUtils.cs +++ b/Dalamud/Utility/AsyncUtils.cs @@ -51,7 +51,7 @@ public static class AsyncUtils { try { - await Task.Delay(millisecondsDelay, cancellationToken); + await Task.Delay(millisecondsDelay, cancellationToken).ConfigureAwait(false); } catch (TaskCanceledException) { diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index 5e9568845..8e25367e5 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit 5e9568845ac302540ce1135abbff7bef98314714 +Subproject commit 8e25367e5f7d3acbe8e2b2a81121852b1ea1291c