mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
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:
parent
0014bfa6fc
commit
956e310041
3 changed files with 5 additions and 9 deletions
|
|
@ -91,11 +91,7 @@ public class HappyEyeballsCallback : IDisposable
|
||||||
private async Task<NetworkStream> AttemptConnection(IPAddress address, int port, CancellationToken token, CancellationToken delayToken)
|
private async Task<NetworkStream> AttemptConnection(IPAddress address, int port, CancellationToken token, CancellationToken delayToken)
|
||||||
{
|
{
|
||||||
await AsyncUtils.CancellableDelay(-1, delayToken).ConfigureAwait(false);
|
await AsyncUtils.CancellableDelay(-1, delayToken).ConfigureAwait(false);
|
||||||
|
token.ThrowIfCancellationRequested();
|
||||||
if (token.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return Task.FromCanceled<NetworkStream>(token).Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
var socket = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
|
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)
|
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 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.
|
// 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);
|
var dnsRecords = await Dns.GetHostAddressesAsync(hostname, this.forcedAddressFamily, token);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public static class AsyncUtils
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Task.Delay(millisecondsDelay, cancellationToken);
|
await Task.Delay(millisecondsDelay, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (TaskCanceledException)
|
catch (TaskCanceledException)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5e9568845ac302540ce1135abbff7bef98314714
|
Subproject commit 8e25367e5f7d3acbe8e2b2a81121852b1ea1291c
|
||||||
Loading…
Add table
Add a link
Reference in a new issue