Skip to content

Commit

Permalink
Merge pull request #211 from 0xced/fix-sync-over-async
Browse files Browse the repository at this point in the history
Use GetHostEntry instead of GetHostEntryAsync
  • Loading branch information
mariotoffia authored Sep 17, 2021
2 parents 2597b10 + 3addb32 commit 2a299b8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Ductus.FluentDocker/Extensions/CommandExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ public static bool IsDockerDnsAvailable()
{
try
{
#if NETSTANDARD1_6
Dns.GetHostEntryAsync("host.docker.internal").Wait();
#else
Dns.GetHostEntry("host.docker.internal");
#endif
return true;
}
catch (AggregateException ex)
Expand All @@ -185,7 +189,11 @@ public static IPAddress EmulatedNativeAddress(bool useCache = true)
if (useCache && null != _cachedDockerIpAddress)
return _cachedDockerIpAddress;

#if NETSTANDARD1_6
var hostEntry = Dns.GetHostEntryAsync("host.docker.internal").Result;
#else
var hostEntry = Dns.GetHostEntry("host.docker.internal");
#endif
if (hostEntry.AddressList.Length > 0)
{
// Prefer IPv4 addresses
Expand Down

0 comments on commit 2a299b8

Please sign in to comment.