diff options
| author | Neuheit <38368299+Neuheit@users.noreply.github.com> | 2022-12-08 00:16:18 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-08 00:16:18 -0500 |
| commit | 9e791a92c3dbf12420ec13e8c0b15f70d4dcba78 (patch) | |
| tree | d95415c3a82b34f56cfb8e8b5a07ef3b6faee5d7 | |
| parent | 6621121c1b958f0e3726f3b4f1d9c2604e398504 (diff) | |
Add comments explaining GetAwaiter()
| -rw-r--r-- | Jellyfin.Networking/HappyEyeballs/HttpClientExtension.cs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Jellyfin.Networking/HappyEyeballs/HttpClientExtension.cs b/Jellyfin.Networking/HappyEyeballs/HttpClientExtension.cs index bab02505d..0ceaeaf96 100644 --- a/Jellyfin.Networking/HappyEyeballs/HttpClientExtension.cs +++ b/Jellyfin.Networking/HappyEyeballs/HttpClientExtension.cs @@ -69,6 +69,9 @@ namespace Jellyfin.Networking.HappyEyeballs using var cancelIPv4 = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); var tryConnectAsyncIPv4 = AttemptConnection(AddressFamily.InterNetwork, context, cancelIPv4.Token); + //Both connect tasks use GetAwaiter().GetResult() as the appropriate task has already been completed. + //This results in improved exception handling. + //See https://github.com/dotnet/corefx/pull/29792/files#r189415885 for more details. if (await Task.WhenAny(tryConnectAsyncIPv6, tryConnectAsyncIPv4).ConfigureAwait(false) == tryConnectAsyncIPv6) { if (tryConnectAsyncIPv6.IsCompletedSuccessfully) |
